• R/O
  • SSH

posixpp: 提交

The main posixpp library and associated tests.


Commit MetaInfo

修订版b1b7172b600065fb0c3224f9a97f4350afb90803 (tree)
时间2022-01-11 04:41:07
作者Eric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Merge with other clang-tidy cleanups.

更改概述

差异

diff -r adc44f7e5a6f -r b1b7172b6000 tests/expected.cpp
--- a/tests/expected.cpp Mon Jan 10 11:22:51 2022 -0800
+++ b/tests/expected.cpp Mon Jan 10 11:41:07 2022 -0800
@@ -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