• R/O
  • SSH

posixpp: 提交

The main posixpp library and associated tests.


Commit MetaInfo

修订版a69f8a0de90cef66677db150ee117731703fe38a (tree)
时间2021-06-30 02:38:38
作者Eric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Fix various clang-tidy complaints.

更改概述

差异

diff -r 9eb80934ba7d -r a69f8a0de90c pubincludes/syscalls/linux/simple_io.h
--- a/pubincludes/syscalls/linux/simple_io.h Mon May 10 09:07:00 2021 -0700
+++ b/pubincludes/syscalls/linux/simple_io.h Tue Jun 29 10:38:38 2021 -0700
@@ -3,8 +3,7 @@
33 #include <cstdint>
44 #include <syscalls/linux/syscall.h>
55
6-namespace syscalls {
7-namespace linux {
6+namespace syscalls::linux {
87
98 inline expected_t open(char const *path, int flags, int mode) noexcept
109 {
@@ -47,4 +46,3 @@
4746 }
4847
4948 }
50-}
diff -r 9eb80934ba7d -r a69f8a0de90c tests/expected.cpp
--- a/tests/expected.cpp Mon May 10 09:07:00 2021 -0700
+++ b/tests/expected.cpp Tue Jun 29 10:38:38 2021 -0700
@@ -4,18 +4,18 @@
44
55 class move_detector {
66 public:
7- move_detector(move_detector &&other) { other.moved_from_ = true; }
7+ move_detector(move_detector &&other) noexcept { other.moved_from_ = true; }
88 move_detector(move_detector const &) = default;
99 move_detector() = default;
1010
11- move_detector &operator =(move_detector &&other) {
11+ move_detector &operator =(move_detector &&other) noexcept {
1212 other.moved_from_ = true;
1313 return *this;
1414 }
1515
1616 move_detector &operator =(move_detector const &) = default;
1717
18- bool was_moved_from() const { return moved_from_; }
18+ [[nodiscard]] bool was_moved_from() const { return moved_from_; }
1919
2020 private:
2121 bool moved_from_ = false;
@@ -55,7 +55,7 @@
5555 CHECK_THROWS_AS(result.error(), ::posixpp::no_error_here);
5656 }
5757 }
58- GIVEN("An expectedd<int> result initialized as an error with ENOENT") {
58+ GIVEN("An expected<int> result initialized as an error with ENOENT") {
5959 using expected_t = ::posixpp::expected<int>;
6060 expected_t const result{expected_t::err_tag{}, ENOENT};
6161 THEN(" result.result() throws ::std:system_error ") {
@@ -106,11 +106,11 @@
106106 CHECK_FALSE(result.result().was_moved_from());
107107 }
108108 THEN( " copying the result out doesn't move it.") {
109- move_detector tmp{result.result()};
109+ [[maybe_unused]] move_detector tmp{result.result()};
110110 CHECK_FALSE(result.result().was_moved_from());
111111 }
112112 THEN( " returning it from a lambda also doesn't move it.") {
113- auto result2 = [&result]() -> expected_t { return result; }();
113+ auto result2 = [&result]() -> expected_t { return result; }(); // NOLINT(performance-no-automatic-move)
114114 CHECK_FALSE(result.result().was_moved_from());
115115 }
116116 }
@@ -119,7 +119,7 @@
119119 expected_t result{cant_copy{}};
120120 THEN(" you can still get the result out.") {
121121 // This is just a test to see if the code compiles.
122- auto tmp = result.result();
122+ [[maybe_unused]] auto tmp = result.result();
123123 }
124124 }
125125 }
Show on old repository browser