diff options
author | Juan Gu <juan.gu@mongodb.com> | 2023-05-05 17:59:44 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-17 22:34:33 +0000 |
commit | 02bf3f55f88874bf397b42758c9cd36093633f9e (patch) | |
tree | 3964271e581d4b735252c2462e9a2bdf32df47f6 /src/mongo/executor | |
parent | 41c95363ac628dd0a89fb18c369b0fdef42496e2 (diff) | |
download | mongo-02bf3f55f88874bf397b42758c9cd36093633f9e.tar.gz |
SERVER-60173 Ban implicit capture of `this` via `[=]` in lambda expressions
Diffstat (limited to 'src/mongo/executor')
-rw-r--r-- | src/mongo/executor/mock_async_rpc.h | 2 | ||||
-rw-r--r-- | src/mongo/executor/task_executor_test_common.cpp | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/executor/mock_async_rpc.h b/src/mongo/executor/mock_async_rpc.h index 5af1ae70d07..5e0b5820a5e 100644 --- a/src/mongo/executor/mock_async_rpc.h +++ b/src/mongo/executor/mock_async_rpc.h @@ -109,7 +109,7 @@ public: .onError([](Status s) -> StatusWith<std::vector<HostAndPort>> { return Status{AsyncRPCErrorInfo(s), "Remote command execution failed"}; }) - .then([=, f = std::move(f), p = std::move(p), dbName = dbName.toString()]( + .then([=, this, f = std::move(f), p = std::move(p), dbName = dbName.toString()]( auto&& targets) mutable { stdx::lock_guard lg{_m}; *targetsAttempted = targets; diff --git a/src/mongo/executor/task_executor_test_common.cpp b/src/mongo/executor/task_executor_test_common.cpp index b54c5a6adfb..4e2eb775a74 100644 --- a/src/mongo/executor/task_executor_test_common.cpp +++ b/src/mongo/executor/task_executor_test_common.cpp @@ -287,7 +287,8 @@ EventChainAndWaitingTest::~EventChainAndWaitingTest() { } void EventChainAndWaitingTest::run() { - executor->onEvent(goEvent, [=](const TaskExecutor::CallbackArgs& cbData) { onGo(cbData); }) + executor + ->onEvent(goEvent, [=, this](const TaskExecutor::CallbackArgs& cbData) { onGo(cbData); }) .status_with_transitional_ignore(); executor->signalEvent(goEvent); executor->waitForEvent(goEvent); @@ -340,8 +341,9 @@ void EventChainAndWaitingTest::onGo(const TaskExecutor::CallbackArgs& cbData) { return; } - cbHandle = executor->onEvent( - goEvent, [=](const TaskExecutor::CallbackArgs& cbData) { onGoAfterTriggered(cbData); }); + cbHandle = executor->onEvent(goEvent, [=, this](const TaskExecutor::CallbackArgs& cbData) { + onGoAfterTriggered(cbData); + }); if (!cbHandle.isOK()) { status1 = cbHandle.getStatus(); executor->shutdown(); |