3131#include < future>
3232#include < map>
3333#include < string>
34- #include < type_traits>
3534#include < utility>
3635
3736#include < sdbus-c++/sdbus-c++.h>
4039
4140#include " TestFixture.h"
4241#include " TestProxy.h"
43- #include " Defs.h"
4442
4543using ::testing::Eq;
4644using namespace std ::chrono_literals;
@@ -82,14 +80,14 @@ struct Task {
8280 return {};
8381 }
8482
85- void return_value (T v ) { value = std::move (v ); }
83+ void return_value (T val ) { value = std::move (val ); }
8684 void unhandled_exception () { exception = std::current_exception (); }
8785 };
8886
8987 std::coroutine_handle<promise_type> handle;
9088
9189 // Ctor and rule of 5 for proper handle management
92- explicit Task (std::coroutine_handle<promise_type> h ) : handle(h ) {}
90+ explicit Task (std::coroutine_handle<promise_type> hnd ) : handle(hnd ) {}
9391 Task (Task&& other) noexcept : handle(std::exchange(other.handle, {})) {}
9492 Task& operator =(Task&& other) noexcept {
9593 if (this != &other) {
@@ -121,7 +119,7 @@ struct Task<void> {
121119 return Task{std::coroutine_handle<promise_type>::from_promise (*this )};
122120 }
123121
124- std::suspend_always initial_suspend () noexcept { return {}; }
122+ std::suspend_always initial_suspend () noexcept { return {}; } // NOLINT(readability-convert-member-functions-to-static)
125123
126124 std::suspend_always final_suspend () noexcept
127125 {
@@ -142,7 +140,7 @@ struct Task<void> {
142140
143141 std::coroutine_handle<promise_type> handle;
144142
145- explicit Task (std::coroutine_handle<promise_type> h ) : handle(h ) {}
143+ explicit Task (std::coroutine_handle<promise_type> hnd ) : handle(hnd ) {}
146144 Task (Task&& other) noexcept : handle(std::exchange(other.handle, {})) {}
147145 Task& operator =(Task&& other) noexcept {
148146 if (this != &other) {
@@ -156,8 +154,8 @@ struct Task<void> {
156154
157155 ~Task () { if (handle) handle.destroy (); }
158156
159- void resume () { if (handle && !handle.done ()) handle.resume (); }
160- void get () { handle.promise ().future .get (); }
157+ void resume () { if (handle && !handle.done ()) handle.resume (); } // NOLINT(readability-make-member-function-const)
158+ void get () { handle.promise ().future .get (); } // NOLINT(readability-make-member-function-const)
161159};
162160
163161/* -------------------------------------*/
@@ -195,9 +193,11 @@ TYPED_TEST(AsyncSdbusTestObject, InvokesMethodWithLargeDataAsynchronouslyOnClien
195193 for (int32_t i = 0 ; i < 40'000 ; ++i)
196194 largeMap.emplace (i, " This is string nr. " + std::to_string (i+1 ));
197195
198- auto task = [&largeMap, this ]() -> Task<std::map<int32_t , std::string>> {
196+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines) -- lambda closure has guaranteed lifetime
197+ auto lambda = [&largeMap, this ]() -> Task<std::map<int32_t , std::string>> {
199198 co_return co_await this ->m_proxy ->doOperationWithLargeDataClientSideAsync (largeMap, sdbus::with_awaitable);
200- }();
199+ };
200+ auto task = lambda ();
201201
202202 task.resume ();
203203
0 commit comments