[build] Remove -unused-lambda-capture warnings
Bug: TC-488
Change-Id: Iea0c66a79c746fd4b7c10cecb6d601e76720b8df
diff --git a/garnet/bin/a11y/tests/mocks/mock_settings_service.cc b/garnet/bin/a11y/tests/mocks/mock_settings_service.cc
index d3e0a67..cc81a27 100644
--- a/garnet/bin/a11y/tests/mocks/mock_settings_service.cc
+++ b/garnet/bin/a11y/tests/mocks/mock_settings_service.cc
@@ -14,7 +14,7 @@
sys::testing::ComponentContextProvider* context)
: context_(context) {
context_->context()->svc()->Connect(manager_.NewRequest());
- manager_.set_error_handler([this](zx_status_t status) {
+ manager_.set_error_handler([](zx_status_t status) {
FX_LOGS(ERROR) << "Cannot connect to SettingsManager with status:"
<< zx_status_get_string(status);
});
diff --git a/garnet/bin/a11y/tests/mocks/mock_settings_watcher.cc b/garnet/bin/a11y/tests/mocks/mock_settings_watcher.cc
index 45f5a65..c1000f0 100644
--- a/garnet/bin/a11y/tests/mocks/mock_settings_watcher.cc
+++ b/garnet/bin/a11y/tests/mocks/mock_settings_watcher.cc
@@ -15,7 +15,7 @@
sys::testing::ComponentContextProvider* context)
: context_provider_(context) {
context_provider_->context()->svc()->Connect(manager_.NewRequest());
- manager_.set_error_handler([this](zx_status_t status) {
+ manager_.set_error_handler([](zx_status_t status) {
FX_LOGS(ERROR) << "Cannot connect to SettingsManager with status:"
<< zx_status_get_string(status);
});
diff --git a/garnet/bin/appmgr/component_controller_unittest.cc b/garnet/bin/appmgr/component_controller_unittest.cc
index 3dd7370..eea4d27 100644
--- a/garnet/bin/appmgr/component_controller_unittest.cc
+++ b/garnet/bin/appmgr/component_controller_unittest.cc
@@ -611,7 +611,7 @@
CreateComponentBridge(component_ptr, std::move(export_dir_req));
RunLoopUntil(
- [this, &component] { return PathExists(component->hub_dir(), "out"); });
+ [&component] { return PathExists(component->hub_dir(), "out"); });
EXPECT_STREQ(get_value(component->hub_dir(), "name").c_str(), "test-label");
EXPECT_STREQ(get_value(component->hub_dir(), "args").c_str(), "test-arg");
@@ -640,7 +640,7 @@
CreateComponentBridge(component_ptr, std::move(export_dir_req), ns);
RunLoopUntil(
- [this, &component] { return PathExists(component->hub_dir(), "out"); });
+ [&component] { return PathExists(component->hub_dir(), "out"); });
AssertHubHasIncomingServices(component.get(), {"service_a", "service_b"});
}
diff --git a/garnet/bin/appmgr/realm.cc b/garnet/bin/appmgr/realm.cc
index d12f497..00f666d 100644
--- a/garnet/bin/appmgr/realm.cc
+++ b/garnet/bin/appmgr/realm.cc
@@ -499,7 +499,7 @@
auto trace_id = TRACE_NONCE();
TRACE_ASYNC_BEGIN("appmgr", "Realm::ResolveLoader::LoadUrl", trace_id, "url",
canon_url);
- loader_->LoadUrl(canon_url, [this, trace_id, callback = std::move(callback)](
+ loader_->LoadUrl(canon_url, [trace_id, callback = std::move(callback)](
fuchsia::sys::PackagePtr package) mutable {
TRACE_ASYNC_END("appmgr", "Realm::ResolveLoader::LoadUrl", trace_id);
diff --git a/garnet/bin/developer/tiles/tiles_unittest.cc b/garnet/bin/developer/tiles/tiles_unittest.cc
index ae6cc9d..9cfeed6 100644
--- a/garnet/bin/developer/tiles/tiles_unittest.cc
+++ b/garnet/bin/developer/tiles/tiles_unittest.cc
@@ -108,7 +108,7 @@
});
tiles()->AddTileFromURL("test_nofocus_tile", /* allow_focus */ false, {},
- [&key](uint32_t _cb_key) {
+ [](uint32_t _cb_key) {
// noop
});
tiles()->ListTiles([](std::vector<uint32_t> keys,
diff --git a/garnet/bin/display_capture_test/runner.cc b/garnet/bin/display_capture_test/runner.cc
index 80bcfc7..1a8c136 100644
--- a/garnet/bin/display_capture_test/runner.cc
+++ b/garnet/bin/display_capture_test/runner.cc
@@ -246,7 +246,7 @@
display_controller_.events().ClientOwnershipChange =
fit::bind_member(this, &Runner::OnClientOwnershipChange);
display_controller_.events().Vsync = fit::bind_member(this, &Runner::OnVsync);
- display_controller_.set_error_handler([this](zx_status_t status) {
+ display_controller_.set_error_handler([](zx_status_t status) {
ZX_ASSERT_MSG(false, "Display controller failure");
});
diff --git a/garnet/bin/media/codecs/test/chunk_input_stream_tests.cc b/garnet/bin/media/codecs/test/chunk_input_stream_tests.cc
index 09f2fdc..a86bab1 100644
--- a/garnet/bin/media/codecs/test/chunk_input_stream_tests.cc
+++ b/garnet/bin/media/codecs/test/chunk_input_stream_tests.cc
@@ -165,8 +165,8 @@
bool was_called_for_input_block = false;
bool flush_called = false;
auto input_block_processor =
- [&was_called_for_input_block, &flush_called, kChunkSize,
- kExpectedByte](ChunkInputStream::InputBlock input_block) {
+ [&was_called_for_input_block, &flush_called,
+ kChunkSize](ChunkInputStream::InputBlock input_block) {
if (input_block.is_end_of_stream) {
flush_called = true;
const size_t expected[kChunkSize] = {kExpectedByte};
diff --git a/garnet/bin/media/codecs/test/mpsc_queue_tests.cc b/garnet/bin/media/codecs/test/mpsc_queue_tests.cc
index 15aadf4..fdcd5db 100644
--- a/garnet/bin/media/codecs/test/mpsc_queue_tests.cc
+++ b/garnet/bin/media/codecs/test/mpsc_queue_tests.cc
@@ -38,7 +38,7 @@
}
async::Loop producer_loop(&kAsyncLoopConfigNoAttachToThread);
- async::PostTask(producer_loop.dispatcher(), [&under_test, &expectation] {
+ async::PostTask(producer_loop.dispatcher(), [&under_test] {
for (int i = 0; i < kElements; ++i) {
under_test.Push(i);
}
@@ -68,7 +68,7 @@
}
async::Loop producer_loop(&kAsyncLoopConfigNoAttachToThread);
- async::PostTask(producer_loop.dispatcher(), [&under_test, &expectation] {
+ async::PostTask(producer_loop.dispatcher(), [&under_test] {
for (int i = 0; i < kElements; ++i) {
under_test.Push(i);
}
diff --git a/garnet/bin/ui/input/main.cc b/garnet/bin/ui/input/main.cc
index e7c5a1c..cfa984e 100644
--- a/garnet/bin/ui/input/main.cc
+++ b/garnet/bin/ui/input/main.cc
@@ -555,7 +555,7 @@
// MOVE
async::PostDelayedTask(
async_get_default_dispatcher(),
- [this, i, x0, y0, deltaX, deltaY, move_event_count] {
+ [this, i, x0, y0, deltaX, deltaY] {
SendTouchEvent(x0 + round(i * deltaX), y0 + round(i * deltaY));
},
swipe_event_delay * i);
diff --git a/garnet/drivers/video/amlogic-decoder/tests/integration/test_vp9.cc b/garnet/drivers/video/amlogic-decoder/tests/integration/test_vp9.cc
index dfb8f0c..db3814c 100644
--- a/garnet/drivers/video/amlogic-decoder/tests/integration/test_vp9.cc
+++ b/garnet/drivers/video/amlogic-decoder/tests/integration/test_vp9.cc
@@ -258,14 +258,13 @@
uint32_t frame_count = 0;
std::promise<void> wait_valid;
- bool frames_returned = false; // Protected by video->video_decoder_lock_
std::vector<std::shared_ptr<VideoFrame>> frames_to_return;
uint64_t next_pts = 0;
{
std::lock_guard<std::mutex> lock(video->video_decoder_lock_);
video->video_decoder_->SetFrameReadyNotifier(
- [&video, &frames_to_return, &frame_count, &wait_valid,
- &frames_returned, &next_pts](std::shared_ptr<VideoFrame> frame) {
+ [&video, &frame_count, &wait_valid,
+ &next_pts](std::shared_ptr<VideoFrame> frame) {
++frame_count;
DLOG("Got frame %d, pts: %ld\n", frame_count, frame->pts);
#if DUMP_VIDEO_TO_FILE
@@ -340,8 +339,7 @@
{
std::lock_guard<std::mutex> lock(video->video_decoder_lock_);
video->video_decoder_->SetFrameReadyNotifier(
- [&video, &frame_count, &wait_valid,
- filename](std::shared_ptr<VideoFrame> frame) {
+ [&video, &frame_count, &wait_valid](std::shared_ptr<VideoFrame> frame) {
++frame_count;
DLOG("Got frame %d\n", frame_count);
#if DUMP_VIDEO_TO_FILE
diff --git a/garnet/drivers/virtual_camera/virtual_camera_control.cpp b/garnet/drivers/virtual_camera/virtual_camera_control.cpp
index d2dd61a..e2bea03 100644
--- a/garnet/drivers/virtual_camera/virtual_camera_control.cpp
+++ b/garnet/drivers/virtual_camera/virtual_camera_control.cpp
@@ -209,7 +209,7 @@
VirtualCameraControlImpl& owner,
fidl::InterfaceRequest<fuchsia::camera::Stream> stream)
: owner_(owner), binding_(this, std::move(stream)) {
- binding_.set_error_handler([this](zx_status_t status) {
+ binding_.set_error_handler([](zx_status_t status) {
// Anything to do here?
});
}
diff --git a/garnet/examples/media/use_media_decoder/use_aac_decoder.cc b/garnet/examples/media/use_media_decoder/use_aac_decoder.cc
index a22a22f..ef8196a3 100644
--- a/garnet/examples/media/use_media_decoder/use_aac_decoder.cc
+++ b/garnet/examples/media/use_media_decoder/use_aac_decoder.cc
@@ -296,8 +296,8 @@
// sync. In this case the test file is clean, so by parsing the aac
// frame length we can skip forward and avoid getting fooled by the fake
// syncword(s).
- auto queue_access_unit = [&codec_client, &input_bytes](
- uint8_t* bytes, size_t byte_count) {
+ auto queue_access_unit = [&codec_client](uint8_t* bytes,
+ size_t byte_count) {
size_t bytes_so_far = 0;
// printf("queuing offset: %ld byte_count: %zu\n", bytes -
// input_bytes.get(), byte_count);
diff --git a/garnet/examples/media/use_media_decoder/use_video_decoder.cc b/garnet/examples/media/use_media_decoder/use_video_decoder.cc
index 7c69cc0..6cfc94e 100644
--- a/garnet/examples/media/use_media_decoder/use_video_decoder.cc
+++ b/garnet/examples/media/use_media_decoder/use_video_decoder.cc
@@ -114,9 +114,8 @@
// Raw .h264 has start code 00 00 01 or 00 00 00 01 before each NAL, and
// the start codes don't alias in the middle of NALs, so we just scan
// for NALs and send them in to the decoder.
- auto queue_access_unit = [&codec_client, &input_bytes,
- &input_frame_pts_counter](uint8_t* bytes,
- size_t byte_count) {
+ auto queue_access_unit = [&codec_client, &input_frame_pts_counter](
+ uint8_t* bytes, size_t byte_count) {
size_t bytes_so_far = 0;
// printf("queuing offset: %ld byte_count: %zu\n", bytes -
// input_bytes.get(), byte_count);
@@ -206,9 +205,8 @@
void QueueVp9Frames(CodecClient* codec_client, uint8_t* input_bytes,
size_t input_size) {
uint64_t input_frame_pts_counter = 0;
- auto queue_access_unit = [&codec_client, &input_bytes,
- &input_frame_pts_counter](uint8_t* bytes,
- size_t byte_count) {
+ auto queue_access_unit = [&codec_client, &input_frame_pts_counter](
+ uint8_t* bytes, size_t byte_count) {
std::unique_ptr<fuchsia::media::Packet> packet =
codec_client->BlockingGetFreeInputPacket();
ZX_ASSERT(packet->has_header());
diff --git a/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc b/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc
index 24f3a0c..67c4b18 100644
--- a/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc
+++ b/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc
@@ -102,7 +102,7 @@
TRACE_FLOW_BEGIN("gfx", "image_pipe_present_image", image_id);
image_pipe_->PresentImage(
image_id, now_ns, std::move(acquire_fences), std::move(release_fences),
- [this](fuchsia::images::PresentationInfo presentation_info) {
+ [](fuchsia::images::PresentationInfo presentation_info) {
std::cout << "PresentImageCallback() called" << std::endl;
});
}
diff --git a/garnet/lib/perfmon/config.h b/garnet/lib/perfmon/config.h
index 16f3db4..58970eb 100644
--- a/garnet/lib/perfmon/config.h
+++ b/garnet/lib/perfmon/config.h
@@ -120,13 +120,13 @@
private:
struct EventHash {
- inline std::size_t operator()(const EventConfig& event) {
- return event.event;
+ inline std::size_t operator()(const EventConfig& event) const {
+ return event.event;
}
};
struct EventEqual {
- inline bool operator()(const EventConfig& e1, const EventConfig& e2) {
- return e1.event == e2.event;
+ inline bool operator()(const EventConfig& e1, const EventConfig& e2) const {
+ return e1.event == e2.event;
}
};
diff --git a/garnet/lib/ui/gfx/id.h b/garnet/lib/ui/gfx/id.h
index 01e5869..f97a0a3 100644
--- a/garnet/lib/ui/gfx/id.h
+++ b/garnet/lib/ui/gfx/id.h
@@ -20,7 +20,7 @@
explicit operator bool();
struct Hash {
- size_t operator()(const GlobalId& id) {
+ size_t operator()(const GlobalId& id) const {
static_assert(sizeof(SessionId) == sizeof(uint64_t));
static_assert(sizeof(ResourceId) == sizeof(uint32_t));
diff --git a/garnet/lib/ui/gfx/tests/gfx_viewstate_apptest.cc b/garnet/lib/ui/gfx/tests/gfx_viewstate_apptest.cc
index 36d9c12..5426f07 100644
--- a/garnet/lib/ui/gfx/tests/gfx_viewstate_apptest.cc
+++ b/garnet/lib/ui/gfx/tests/gfx_viewstate_apptest.cc
@@ -55,7 +55,7 @@
CreateNewEnclosingEnvironment(kEnvironment, std::move(services));
environment_->ConnectToService(scenic_.NewRequest());
- scenic_.set_error_handler([this](zx_status_t status) {
+ scenic_.set_error_handler([](zx_status_t status) {
FAIL() << "Lost connection to Scenic: " << status;
});
}
diff --git a/garnet/lib/ui/gfx/tests/import_unittest.cc b/garnet/lib/ui/gfx/tests/import_unittest.cc
index 3ceab15..11a85026 100644
--- a/garnet/lib/ui/gfx/tests/import_unittest.cc
+++ b/garnet/lib/ui/gfx/tests/import_unittest.cc
@@ -247,7 +247,7 @@
TEST_F(ImportTest, KillingImportedResourceEvictsFromResourceLinker) {
bool called = false;
resource_linker_->SetOnExpiredCallback(
- [this, &called](Resource*, ResourceLinker::ExpirationCause cause) {
+ [&called](Resource*, ResourceLinker::ExpirationCause cause) {
ASSERT_EQ(ResourceLinker::ExpirationCause::kResourceDestroyed, cause);
called = true;
});
diff --git a/garnet/lib/ui/gfx/tests/resource_linker_unittest.cc b/garnet/lib/ui/gfx/tests/resource_linker_unittest.cc
index 1b8a114..bcf944f 100644
--- a/garnet/lib/ui/gfx/tests/resource_linker_unittest.cc
+++ b/garnet/lib/ui/gfx/tests/resource_linker_unittest.cc
@@ -188,7 +188,7 @@
});
async::PostTask(dispatcher(),
- [this, &import, &resource, linker, &did_resolve,
+ [this, &import, linker, &did_resolve,
destination = std::move(destination)]() mutable {
import = fxl::MakeRefCounted<Import>(
session_.get(), 1, ::fuchsia::ui::gfx::ImportSpec::NODE,
@@ -370,7 +370,7 @@
bool called = false;
async::PostTask(dispatcher(), [this, linker, source = std::move(source),
- &destination, &called]() mutable {
+ &called]() mutable {
// Register the resource.
auto resource =
fxl::MakeRefCounted<EntityNode>(session_.get(), 1 /* resource id */);
diff --git a/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc b/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc
index fba25b0..1a3ceed 100644
--- a/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc
+++ b/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc
@@ -91,7 +91,7 @@
CreateNewEnclosingEnvironment(kEnvironment, std::move(services));
environment_->ConnectToService(scenic_.NewRequest());
- scenic_.set_error_handler([this](zx_status_t status) {
+ scenic_.set_error_handler([](zx_status_t status) {
FAIL() << "Lost connection to Scenic: " << zx_status_get_string(status);
});
}
diff --git a/garnet/lib/ui/input/tests/coordinate_transform_test.cc b/garnet/lib/ui/input/tests/coordinate_transform_test.cc
index 4e0e9ff..d9e796b 100644
--- a/garnet/lib/ui/input/tests/coordinate_transform_test.cc
+++ b/garnet/lib/ui/input/tests/coordinate_transform_test.cc
@@ -183,7 +183,7 @@
#endif
});
- client_1.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_1.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 6u) << "Should receive exactly 6 input events.";
// ADD
@@ -216,7 +216,7 @@
PointerEventPhase::REMOVE, 6, 2));
});
- client_2.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_2.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 5u) << "Should receive exactly 5 input events.";
// ADD
diff --git a/garnet/lib/ui/input/tests/focus_avoidance_test.cc b/garnet/lib/ui/input/tests/focus_avoidance_test.cc
index 650ae24..48a6375 100644
--- a/garnet/lib/ui/input/tests/focus_avoidance_test.cc
+++ b/garnet/lib/ui/input/tests/focus_avoidance_test.cc
@@ -202,7 +202,7 @@
#endif
});
- client_1.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_1.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 5u) << "Should receive exactly 5 input events.";
// ADD
@@ -232,7 +232,7 @@
PointerMatches(events[4].pointer(), 2u, PointerEventPhase::DOWN, 4, 4));
});
- client_2.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_2.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 2u) << "Should receive exactly 2 input events.";
// ADD
diff --git a/garnet/lib/ui/input/tests/hard_keyboard_delivery_test.cc b/garnet/lib/ui/input/tests/hard_keyboard_delivery_test.cc
index 33b00ae..d23b4c5 100644
--- a/garnet/lib/ui/input/tests/hard_keyboard_delivery_test.cc
+++ b/garnet/lib/ui/input/tests/hard_keyboard_delivery_test.cc
@@ -154,7 +154,7 @@
});
// Verify client's inputs do *not* include keyboard events.
- client.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 3u) << "Should receive exactly 3 input events.";
// ADD
@@ -207,7 +207,7 @@
});
// Verify client's inputs include keyboard events.
- client.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 2u) << "Should receive exactly 2 input events.";
});
}
diff --git a/garnet/lib/ui/input/tests/mouse_delivery_test.cc b/garnet/lib/ui/input/tests/mouse_delivery_test.cc
index fd5fef3..530b7f4 100644
--- a/garnet/lib/ui/input/tests/mouse_delivery_test.cc
+++ b/garnet/lib/ui/input/tests/mouse_delivery_test.cc
@@ -196,7 +196,7 @@
});
// Verify client 1's inputs have mouse events.
- client_1.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_1.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 7u) << "Should receive exactly 7 input events.";
// MOVE
@@ -235,7 +235,7 @@
});
// Verify client 2's input has one mouse event.
- client_2.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_2.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 1u) << "Should receive exactly 1 event.";
// MOVE
@@ -354,7 +354,7 @@
});
// Verify client 1's inputs have mouse events.
- client_1.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_1.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 6u) << "Should receive exactly 6 input events.";
// MOVE
@@ -389,7 +389,7 @@
});
// Verify client 2's input has one mouse event.
- client_2.ExamineEvents([this](const std::vector<InputEvent>& events) {
+ client_2.ExamineEvents([](const std::vector<InputEvent>& events) {
EXPECT_EQ(events.size(), 1u) << "Should receive exactly 1 event.";
// MOVE
diff --git a/garnet/lib/vulkan/tests/vklatency/main_scenic.cc b/garnet/lib/vulkan/tests/vklatency/main_scenic.cc
index 17f924d..7f79a8c 100644
--- a/garnet/lib/vulkan/tests/vklatency/main_scenic.cc
+++ b/garnet/lib/vulkan/tests/vklatency/main_scenic.cc
@@ -20,7 +20,7 @@
const bool protected_output = command_line.HasOption("protected_output");
scenic::ViewProviderComponent component(
- [&loop, protected_output](scenic::ViewContext view_context) {
+ [protected_output](scenic::ViewContext view_context) {
return std::make_unique<examples::ImagePipeView>(
std::move(view_context), protected_output);
},
diff --git a/garnet/public/lib/network_wrapper/network_wrapper_impl_unittest.cc b/garnet/public/lib/network_wrapper/network_wrapper_impl_unittest.cc
index ccc01a79..ed1404e 100644
--- a/garnet/public/lib/network_wrapper/network_wrapper_impl_unittest.cc
+++ b/garnet/public/lib/network_wrapper/network_wrapper_impl_unittest.cc
@@ -150,9 +150,8 @@
SetStringResponse("Hello", 200);
return NewRequest("GET", "http://example.com");
},
- [this, destroy_watcher = fit::defer([&callback_destroyed] {
- callback_destroyed = true;
- }),
+ [destroy_watcher =
+ fit::defer([&callback_destroyed] { callback_destroyed = true; }),
&response](http::URLResponse received_response) {
response = std::move(received_response);
});
@@ -171,10 +170,11 @@
SetStringResponse("Hello", 200);
return NewRequest("GET", "http://example.com");
},
- [this, &received_response,
- destroy_watcher = fit::defer([this, &callback_destroyed] {
- callback_destroyed = true;
- })](http::URLResponse) { received_response = true; });
+ [&received_response, destroy_watcher = fit::defer([&callback_destroyed] {
+ callback_destroyed = true;
+ })](http::URLResponse) {
+ received_response = true;
+ });
async::PostTask(dispatcher(), [cancel] { cancel->Cancel(); });
cancel = nullptr;
@@ -195,7 +195,7 @@
SetStringResponse("Hello", 200);
return NewRequest("GET", "http://example.com");
},
- [this, &response](http::URLResponse received_response) {
+ [&response](http::URLResponse received_response) {
response = std::move(received_response);
});
RunLoopUntilIdle();
@@ -217,7 +217,7 @@
++request_count;
return NewRequest("GET", "http://example.com");
},
- [this, &response](http::URLResponse received_response) {
+ [&response](http::URLResponse received_response) {
response = std::move(received_response);
});
RunLoopUntilIdle();
@@ -235,7 +235,7 @@
SetStringResponse("Hello", 200);
return NewRequest("GET", "http://example.com");
},
- [this, &request, &response](http::URLResponse received_response) mutable {
+ [&request, &response](http::URLResponse received_response) mutable {
response = fidl::MakeOptional(std::move(received_response));
request->Cancel();
request = nullptr;
diff --git a/peridot/bin/basemgr/session_provider.cc b/peridot/bin/basemgr/session_provider.cc
index fabdc6f..a2d3887 100644
--- a/peridot/bin/basemgr/session_provider.cc
+++ b/peridot/bin/basemgr/session_provider.cc
@@ -44,7 +44,7 @@
if (logout_users) {
delegate_->LogoutUsers(
- [this, delete_session_context]() { delete_session_context(); });
+ [delete_session_context]() { delete_session_context(); });
} else {
delete_session_context();
}
diff --git a/peridot/bin/basemgr/session_user_provider_impl.cc b/peridot/bin/basemgr/session_user_provider_impl.cc
index 8b9d998..00727ce 100644
--- a/peridot/bin/basemgr/session_user_provider_impl.cc
+++ b/peridot/bin/basemgr/session_user_provider_impl.cc
@@ -101,7 +101,7 @@
// Register SessionUserProvider as an AccountListener. All added accounts will
// be logged in to a session.
- account_listener_binding_.set_error_handler([this](zx_status_t status) {
+ account_listener_binding_.set_error_handler([](zx_status_t status) {
FXL_LOG(FATAL) << "AccountListener disconnected with status: "
<< zx_status_get_string(status);
});
@@ -189,7 +189,7 @@
fuchsia::auth::account::AccountPtr account;
account_manager_->GetAccount(
account_id, authentication_context_provider_binding_.NewBinding(),
- account.NewRequest(), [this](fuchsia::auth::account::Status status) {
+ account.NewRequest(), [](fuchsia::auth::account::Status status) {
FXL_LOG(INFO) << "Got account with status: " << (uint32_t)status;
});
@@ -205,7 +205,7 @@
fuchsia::auth::TokenManagerPtr ledger_token_manager;
persona->GetTokenManager(
kSessionUserProviderAppUrl, ledger_token_manager.NewRequest(),
- [this](fuchsia::auth::account::Status status) {
+ [](fuchsia::auth::account::Status status) {
FXL_LOG(INFO) << "Got token manager with status: "
<< (uint32_t)status;
});
@@ -213,7 +213,7 @@
fuchsia::auth::TokenManagerPtr agent_token_manager;
persona->GetTokenManager(
kSessionUserProviderAppUrl, agent_token_manager.NewRequest(),
- [this](fuchsia::auth::account::Status status) {
+ [](fuchsia::auth::account::Status status) {
FXL_LOG(INFO) << "Got token manager with status: "
<< (uint32_t)status;
});
diff --git a/peridot/bin/modular_test_harness/modular_test_harness.cc b/peridot/bin/modular_test_harness/modular_test_harness.cc
index 6b3772c..e9a844b 100644
--- a/peridot/bin/modular_test_harness/modular_test_harness.cc
+++ b/peridot/bin/modular_test_harness/modular_test_harness.cc
@@ -20,7 +20,7 @@
auto context = sys::ComponentContext::Create();
auto env = context->svc()->Connect<fuchsia::sys::Environment>();
context->outgoing()->AddPublicService<fuchsia::modular::testing::TestHarness>(
- [&loop, &context, &env, &test_harness_impl](
+ [&loop, &env, &test_harness_impl](
fidl::InterfaceRequest<fuchsia::modular::testing::TestHarness>
request) {
test_harness_impl = std::make_unique<modular::testing::TestHarnessImpl>(
diff --git a/peridot/bin/sessionctl/session_ctl_app.cc b/peridot/bin/sessionctl/session_ctl_app.cc
index a7a58a1..479fe2e 100644
--- a/peridot/bin/sessionctl/session_ctl_app.cc
+++ b/peridot/bin/sessionctl/session_ctl_app.cc
@@ -287,7 +287,7 @@
"Sessionctl StoryPuppetMaster::Execute");
story_puppet_master_->Execute(
- [this, fut](fuchsia::modular::ExecuteResult result) mutable {
+ [fut](fuchsia::modular::ExecuteResult result) mutable {
if (result.status == fuchsia::modular::ExecuteStatus::OK) {
fut->Complete(false, result.story_id->c_str());
} else {
diff --git a/peridot/bin/sessionmgr/agent_runner/agent_runner.cc b/peridot/bin/sessionmgr/agent_runner/agent_runner.cc
index 4ccd44b..0072dc2 100644
--- a/peridot/bin/sessionmgr/agent_runner/agent_runner.cc
+++ b/peridot/bin/sessionmgr/agent_runner/agent_runner.cc
@@ -69,7 +69,7 @@
// This is called when agents are done being removed
auto called = std::make_shared<bool>(false);
fit::function<void(const bool)> termination_callback =
- [this, called,
+ [called,
callback = std::move(callback)](const bool from_timeout) mutable {
if (*called) {
return;
diff --git a/peridot/bin/sessionmgr/dev_session_shell.cc b/peridot/bin/sessionmgr/dev_session_shell.cc
index 33c3878..ded1fc5b 100644
--- a/peridot/bin/sessionmgr/dev_session_shell.cc
+++ b/peridot/bin/sessionmgr/dev_session_shell.cc
@@ -174,7 +174,7 @@
void StartStoryById(const fidl::StringPtr& story_id) {
story_provider_->GetController(story_id, story_controller_.NewRequest());
- story_controller_.set_error_handler([this, story_id](zx_status_t status) {
+ story_controller_.set_error_handler([story_id](zx_status_t status) {
FXL_LOG(ERROR) << "Story controller for story " << story_id
<< " died. Does this story exist?";
});
diff --git a/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc b/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc
index df139db..bdd5076 100644
--- a/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc
+++ b/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/add_mod_call.cc
@@ -200,7 +200,7 @@
// Operation stays alive until flow goes out of scope.
fuchsia::modular::ModuleData module_data;
out_module_data_.Clone(&module_data);
- story_storage_->WriteModuleData(std::move(module_data))->Then([this, flow] {
+ story_storage_->WriteModuleData(std::move(module_data))->Then([flow] {
});
}
diff --git a/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/find_modules_call.cc b/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/find_modules_call.cc
index f823f46..1022c00 100644
--- a/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/find_modules_call.cc
+++ b/peridot/bin/sessionmgr/puppet_master/command_runners/operation_calls/find_modules_call.cc
@@ -64,7 +64,7 @@
constraint_futs_.push_back(
GetTypesFromIntentParameter(std::move(param.data), param.name)
- ->Map([this, name = param.name](std::vector<std::string> types) {
+ ->Map([name = param.name](std::vector<std::string> types) {
fuchsia::modular::FindModulesParameterConstraint constraint;
constraint.param_name = name;
constraint.param_types = std::move(types);
diff --git a/peridot/bin/sessionmgr/puppet_master/command_runners/remove_mod_command_runner.cc b/peridot/bin/sessionmgr/puppet_master/command_runners/remove_mod_command_runner.cc
index 8739f29..f9d59f1 100644
--- a/peridot/bin/sessionmgr/puppet_master/command_runners/remove_mod_command_runner.cc
+++ b/peridot/bin/sessionmgr/puppet_master/command_runners/remove_mod_command_runner.cc
@@ -45,7 +45,7 @@
(*module_data)->module_deleted = true;
result_.status = fuchsia::modular::ExecuteStatus::OK;
})
- ->Then([this, flow] {});
+ ->Then([flow] {});
}
StoryStorage* const story_storage_;
diff --git a/peridot/bin/sessionmgr/puppet_master/command_runners/set_link_value_command_runner.cc b/peridot/bin/sessionmgr/puppet_master/command_runners/set_link_value_command_runner.cc
index 0f1aad8..486235c 100644
--- a/peridot/bin/sessionmgr/puppet_master/command_runners/set_link_value_command_runner.cc
+++ b/peridot/bin/sessionmgr/puppet_master/command_runners/set_link_value_command_runner.cc
@@ -21,8 +21,8 @@
AddSetLinkValueOperation(
&operation_queue_, story_storage,
std::move(command.set_link_value().path),
- [this, new_value = std::move(command.set_link_value().value)](
- fidl::StringPtr* value) {
+ [new_value =
+ std::move(command.set_link_value().value)](fidl::StringPtr* value) {
std::string str_value;
FXL_CHECK(fsl::StringFromVmo(*new_value, &str_value));
*value = str_value;
diff --git a/peridot/bin/sessionmgr/storage/session_storage.cc b/peridot/bin/sessionmgr/storage/session_storage.cc
index 3c46cc0..218ade3 100644
--- a/peridot/bin/sessionmgr/storage/session_storage.cc
+++ b/peridot/bin/sessionmgr/storage/session_storage.cc
@@ -104,8 +104,8 @@
story_data_->mutable_story_info()->id = story_name_;
story_data_->mutable_story_info()->last_focus_time = 0;
story_data_->mutable_story_info()->extra = std::move(extra_info_);
- operation_queue_.Add(MakeWriteStoryDataCall(page(), std::move(story_data_),
- [this, flow] {}));
+ operation_queue_.Add(
+ MakeWriteStoryDataCall(page(), std::move(story_data_), [flow] {}));
}
fidl::StringPtr story_name_;
diff --git a/peridot/bin/sessionmgr/story_runner/link_impl.cc b/peridot/bin/sessionmgr/story_runner/link_impl.cc
index fde382c..032fbb9 100644
--- a/peridot/bin/sessionmgr/story_runner/link_impl.cc
+++ b/peridot/bin/sessionmgr/story_runner/link_impl.cc
@@ -153,7 +153,7 @@
story_storage_
->UpdateLinkValue(
link_path_,
- [this /* for link_path_ */, path = std::move(path)](
+ [path = std::move(path)](
fidl::StringPtr* value) { ApplyEraseOp(value, path); },
this /* context */)
->Then([](StoryStorage::Status status) {
diff --git a/peridot/bin/sessionmgr/story_runner/story_entity_provider.cc b/peridot/bin/sessionmgr/story_runner/story_entity_provider.cc
index a51e25d..b8be1e2 100644
--- a/peridot/bin/sessionmgr/story_runner/story_entity_provider.cc
+++ b/peridot/bin/sessionmgr/story_runner/story_entity_provider.cc
@@ -19,7 +19,7 @@
fit::function<void(std::string /* cookie */)> callback) {
const std::string cookie = uuid::Generate();
story_storage_->SetEntityData(cookie, type, std::move(data))
- ->Then([this, cookie,
+ ->Then([cookie,
callback = std::move(callback)](StoryStorage::Status status) {
if (status == StoryStorage::Status::OK) {
callback(cookie);
diff --git a/peridot/examples/todo_cpp/todo.cc b/peridot/examples/todo_cpp/todo.cc
index 97bf63a..3cc3198 100644
--- a/peridot/examples/todo_cpp/todo.cc
+++ b/peridot/examples/todo_cpp/todo.cc
@@ -128,7 +128,7 @@
}
void TodoApp::List(fuchsia::ledger::PageSnapshotPtr snapshot) {
- GetEntries(std::move(snapshot), [this](auto entries) {
+ GetEntries(std::move(snapshot), [](auto entries) {
std::cout << "--- To Do ---" << std::endl;
for (auto& entry : entries) {
std::cout << (entry.value ? ToString(*entry.value) : "<empty>")
diff --git a/peridot/lib/bound_set/bound_set.h b/peridot/lib/bound_set/bound_set.h
index 815d285..9c70b61 100644
--- a/peridot/lib/bound_set/bound_set.h
+++ b/peridot/lib/bound_set/bound_set.h
@@ -99,9 +99,8 @@
private:
iterator Find(UniqueType id) {
- return std::find_if(elements_.begin(), elements_.end(), [this, id](T& e) {
- return Identify(GetFidlType(&e)) == id;
- });
+ return std::find_if(elements_.begin(), elements_.end(),
+ [id](T& e) { return Identify(GetFidlType(&e)) == id; });
}
std::vector<T> elements_;
diff --git a/peridot/lib/fidl/environment.h b/peridot/lib/fidl/environment.h
index d838492..f2a19bd 100644
--- a/peridot/lib/fidl/environment.h
+++ b/peridot/lib/fidl/environment.h
@@ -36,7 +36,7 @@
void AddService(fidl::InterfaceRequestHandler<Interface> handler,
const std::string& service_name = Interface::Name_) {
auto service = fbl::AdoptRef(new fs::Service(
- [this, handler = std::move(handler)](zx::channel channel) {
+ [handler = std::move(handler)](zx::channel channel) {
handler(fidl::InterfaceRequest<Interface>(std::move(channel)));
return ZX_OK;
}));
diff --git a/peridot/tests/benchmarks/story/modular_benchmark_story_session_shell.cc b/peridot/tests/benchmarks/story/modular_benchmark_story_session_shell.cc
index 3ee3354..11188c8 100644
--- a/peridot/tests/benchmarks/story/modular_benchmark_story_session_shell.cc
+++ b/peridot/tests/benchmarks/story/modular_benchmark_story_session_shell.cc
@@ -251,7 +251,7 @@
void StoryStart() {
FXL_LOG(INFO) << "StoryStart()";
TRACE_ASYNC_BEGIN("benchmark", "story/start", 0);
- story_watcher_.Continue(fuchsia::modular::StoryState::RUNNING, [this] {
+ story_watcher_.Continue(fuchsia::modular::StoryState::RUNNING, [] {
TRACE_ASYNC_END("benchmark", "story/start", 0);
});
diff --git a/peridot/tests/embed_shell/embed_shell_test_parent_module.cc b/peridot/tests/embed_shell/embed_shell_test_parent_module.cc
index 6f93860..c55bdf6 100644
--- a/peridot/tests/embed_shell/embed_shell_test_parent_module.cc
+++ b/peridot/tests/embed_shell/embed_shell_test_parent_module.cc
@@ -43,7 +43,7 @@
private:
void ScheduleDone() {
- auto check = [this, done = std::make_shared<int>(0)] {
+ auto check = [done = std::make_shared<int>(0)] {
++*done;
if (*done == 2) {
Signal(kParentModuleDoneSignal);
diff --git a/peridot/tests/maxwell_integration/maxwell_service_provider_bridge.h b/peridot/tests/maxwell_integration/maxwell_service_provider_bridge.h
index dae311a..ee1a9b4 100644
--- a/peridot/tests/maxwell_integration/maxwell_service_provider_bridge.h
+++ b/peridot/tests/maxwell_integration/maxwell_service_provider_bridge.h
@@ -23,8 +23,8 @@
template <typename Interface>
void AddService(fidl::InterfaceRequestHandler<Interface> handler) {
- auto service = fbl::AdoptRef(new fs::Service(
- [this, handler = std::move(handler)](zx::channel channel) {
+ auto service = fbl::AdoptRef(
+ new fs::Service([handler = std::move(handler)](zx::channel channel) {
handler(fidl::InterfaceRequest<Interface>(std::move(channel)));
return ZX_OK;
}));
diff --git a/peridot/tests/module_context/module_context_test_module.cc b/peridot/tests/module_context/module_context_test_module.cc
index 1cc20ec..a415219 100644
--- a/peridot/tests/module_context/module_context_test_module.cc
+++ b/peridot/tests/module_context/module_context_test_module.cc
@@ -55,7 +55,7 @@
Await(module_name_ == kFirstModuleName ? kFirstModuleCallDone
: kSecondModuleCallDone,
- [this, module_context] { module_context->RemoveSelfFromStory(); });
+ [module_context] { module_context->RemoveSelfFromStory(); });
Await(module_name_ == kFirstModuleName ? kFirstModuleCallStartActivity
: kSecondModuleCallStartActivity,
[this, module_context] {
@@ -65,7 +65,7 @@
});
Await(module_name_ == kFirstModuleName ? kFirstModuleCallStopActivity
: kSecondModuleCallStopActivity,
- [this, module_context] { ongoing_activity_.Unbind(); });
+ [this] { ongoing_activity_.Unbind(); });
});
}
diff --git a/peridot/tests/module_context/module_context_test_session_shell.cc b/peridot/tests/module_context/module_context_test_session_shell.cc
index 551f7d3..770a9d0 100644
--- a/peridot/tests/module_context/module_context_test_session_shell.cc
+++ b/peridot/tests/module_context/module_context_test_session_shell.cc
@@ -127,7 +127,7 @@
// Starts the story and adds two modules to it.
void StartStory() {
story_provider()->GetController(kStoryName, story_controller_.NewRequest());
- story_controller_.set_error_handler([this](zx_status_t status) {
+ story_controller_.set_error_handler([](zx_status_t status) {
FXL_LOG(ERROR) << "Story controller for story " << kStoryName
<< " died. Does this story exist?";
});
@@ -302,11 +302,11 @@
// Verifies that the story is stopped when the last module that is part of the
// story calls ModuleContext.Done and is stopped.
void IsStoryRunning(fit::function<void(bool)> callback) {
- story_controller_->GetInfo([this, callback = std::move(callback)](
- fuchsia::modular::StoryInfo story_info,
- fuchsia::modular::StoryState state) {
- callback(state == fuchsia::modular::StoryState::RUNNING);
- });
+ story_controller_->GetInfo(
+ [callback = std::move(callback)](fuchsia::modular::StoryInfo story_info,
+ fuchsia::modular::StoryState state) {
+ callback(state == fuchsia::modular::StoryState::RUNNING);
+ });
}
// Creates an intent with one parameter, kLinkName, with the following
diff --git a/peridot/tests/parent_child/parent_child_test_parent_module.cc b/peridot/tests/parent_child/parent_child_test_parent_module.cc
index 41918ba..d9887b6 100644
--- a/peridot/tests/parent_child/parent_child_test_parent_module.cc
+++ b/peridot/tests/parent_child/parent_child_test_parent_module.cc
@@ -116,7 +116,7 @@
// since we serialize these requests in sessionmgr.
AddModuleToStoryWithHandler(module_host_->module_context(),
child_module3_.NewRequest(), kChildModuleUrl1);
- child_module3_->Stop([this] { /* do nothing */ });
+ child_module3_->Stop([] { /* do nothing */ });
child_module3_.events().OnStateChange =
[this](fuchsia::modular::ModuleState module_state) {
if (module_state == fuchsia::modular::ModuleState::RUNNING) {
diff --git a/peridot/tests/queue_persistence/queue_persistence_test_agent.cc b/peridot/tests/queue_persistence/queue_persistence_test_agent.cc
index 60ea8e0..b71410f 100644
--- a/peridot/tests/queue_persistence/queue_persistence_test_agent.cc
+++ b/peridot/tests/queue_persistence/queue_persistence_test_agent.cc
@@ -32,7 +32,7 @@
component_context_->ObtainMessageQueue("Test Queue",
msg_queue_.NewRequest());
msg_queue_.RegisterReceiver(
- [this](std::string message, fit::function<void()> ack) {
+ [](std::string message, fit::function<void()> ack) {
ack();
modular::testing::GetStore()->Put(
"queue_persistence_test_agent_received_message", "", [] {});
diff --git a/peridot/tests/queue_persistence/queue_persistence_test_module.cc b/peridot/tests/queue_persistence/queue_persistence_test_module.cc
index 77701b4..3e36b1b 100644
--- a/peridot/tests/queue_persistence/queue_persistence_test_module.cc
+++ b/peridot/tests/queue_persistence/queue_persistence_test_module.cc
@@ -120,7 +120,7 @@
agent_controller_.Unbind();
agent_service_.Unbind();
Await("queue_persistence_test_agent_stopped",
- [this] { Signal(modular::testing::kTestShutdown); });
+ [] { Signal(modular::testing::kTestShutdown); });
}
modular::ModuleHost* module_host_;
diff --git a/peridot/tests/trigger/trigger_test_session_shell.cc b/peridot/tests/trigger/trigger_test_session_shell.cc
index 71c62c3..f7230cd 100644
--- a/peridot/tests/trigger/trigger_test_session_shell.cc
+++ b/peridot/tests/trigger/trigger_test_session_shell.cc
@@ -71,7 +71,7 @@
"fuchsia::modular::Agent executed message queue task."};
void StartStory() {
story_provider()->GetController(kStoryName, story_controller_.NewRequest());
- story_controller_.set_error_handler([this](zx_status_t status) {
+ story_controller_.set_error_handler([](zx_status_t status) {
FXL_LOG(ERROR) << "Story controller for story " << kStoryName
<< " died. Does this story exist?";
});
diff --git a/sdk/lib/fidl/cpp/binding_unittest.cc b/sdk/lib/fidl/cpp/binding_unittest.cc
index 362cbea..5fc5f31 100644
--- a/sdk/lib/fidl/cpp/binding_unittest.cc
+++ b/sdk/lib/fidl/cpp/binding_unittest.cc
@@ -185,7 +185,7 @@
handle.NewRequest());
int error_count = 0;
- binding.set_error_handler([&error_count, &binding](zx_status_t status) {
+ binding.set_error_handler([&error_count](zx_status_t status) {
EXPECT_EQ(ZX_ERR_INVALID_ARGS, status);
++error_count;
});
diff --git a/sdk/lib/sys/cpp/testing/enclosing_environment.cc b/sdk/lib/sys/cpp/testing/enclosing_environment.cc
index 7cabeeb..b13f41f 100644
--- a/sdk/lib/sys/cpp/testing/enclosing_environment.cc
+++ b/sdk/lib/sys/cpp/testing/enclosing_environment.cc
@@ -209,7 +209,7 @@
}
void EnclosingEnvironment::Kill(fit::function<void()> callback) {
- env_controller_->Kill([this, callback = std::move(callback)]() {
+ env_controller_->Kill([callback = std::move(callback)]() {
if (callback) {
callback();
}
diff --git a/src/connectivity/bluetooth/core/bt-host/att/bearer_unittest.cc b/src/connectivity/bluetooth/core/bt-host/att/bearer_unittest.cc
index ec472941..98de25a 100644
--- a/src/connectivity/bluetooth/core/bt-host/att/bearer_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/att/bearer_unittest.cc
@@ -119,10 +119,9 @@
// error.
bool closed = false;
bool err_cb_called = false;
- bearer()->set_closed_callback(
- [&closed, &err_cb_called, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&closed, &err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_EQ(HostError::kTimedOut, status.error());
EXPECT_EQ(0, handle);
@@ -154,10 +153,9 @@
bool closed = false;
unsigned int err_cb_count = 0u;
- bearer()->set_closed_callback(
- [&err_cb_count, &closed, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&closed, &err_cb_count, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_count](Status status, Handle handle) {
EXPECT_EQ(HostError::kTimedOut, status.error());
EXPECT_EQ(0, handle);
@@ -190,10 +188,9 @@
bool closed = false;
bool err_cb_called = false;
- bearer()->set_closed_callback(
- [&closed, &err_cb_called, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&closed, &err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_EQ(HostError::kTimedOut, status.error());
EXPECT_EQ(0, handle);
@@ -226,10 +223,9 @@
bool closed = false;
unsigned int err_cb_count = 0u;
- bearer()->set_closed_callback(
- [&closed, &err_cb_count, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&closed, &err_cb_count, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_count](Status status, Handle handle) {
EXPECT_EQ(HostError::kTimedOut, status.error());
EXPECT_EQ(0, handle);
@@ -301,9 +297,9 @@
bool err_cb_called = false;
bool closed = false;
- bearer()->set_closed_callback([&closed, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_EQ(HostError::kFailed, status.error());
EXPECT_EQ(0, handle);
@@ -339,9 +335,9 @@
bool err_cb_called = false;
bool closed = false;
- bearer()->set_closed_callback([&closed, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_EQ(0, handle);
EXPECT_EQ(HostError::kFailed, status.error());
@@ -377,9 +373,9 @@
bool err_cb_called = false;
bool closed = false;
- bearer()->set_closed_callback([&closed, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_EQ(0, handle);
EXPECT_EQ(HostError::kFailed, status.error());
@@ -420,9 +416,9 @@
bool err_cb_called = false;
bool closed = false;
- bearer()->set_closed_callback([&closed, this] { closed = true; });
+ bearer()->set_closed_callback([&closed] { closed = true; });
- auto err_cb = [&err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_EQ(0, handle);
EXPECT_EQ(HostError::kFailed, status.error());
@@ -461,7 +457,7 @@
fake_chan()->SetSendCallback(chan_cb, dispatcher());
bool err_cb_called = false;
- auto err_cb = [&err_cb_called, this](Status status, Handle handle) {
+ auto err_cb = [&err_cb_called](Status status, Handle handle) {
EXPECT_TRUE(status.is_protocol_error());
EXPECT_EQ(ErrorCode::kRequestNotSupported, status.protocol_error());
EXPECT_EQ(0x0001, handle);
@@ -1005,14 +1001,14 @@
int req_count = 0;
int ind_count = 0;
- auto req_handler = [&req_id, &req_count, this](auto id, const auto& packet) {
+ auto req_handler = [&req_id, &req_count](auto id, const auto& packet) {
EXPECT_EQ(kTestRequest, packet.opcode());
EXPECT_EQ(0u, packet.payload_size());
req_count++;
req_id = id;
};
- auto ind_handler = [&ind_id, &ind_count, this](auto id, const auto& packet) {
+ auto ind_handler = [&ind_id, &ind_count](auto id, const auto& packet) {
EXPECT_EQ(kIndication, packet.opcode());
EXPECT_EQ(0u, packet.payload_size());
diff --git a/src/connectivity/bluetooth/core/bt-host/data/domain.cc b/src/connectivity/bluetooth/core/bt-host/data/domain.cc
index 0e4d979..651e31c 100644
--- a/src/connectivity/bluetooth/core/bt-host/data/domain.cc
+++ b/src/connectivity/bluetooth/core/bt-host/data/domain.cc
@@ -167,9 +167,8 @@
void RegisterService(l2cap::PSM psm, SocketCallback socket_callback,
async_dispatcher_t* cb_dispatcher) override {
RegisterService(
- psm,
- [this, psm, cb = std::move(socket_callback),
- cb_dispatcher](auto channel) mutable {
+ psm, [ this, cb = std::move(socket_callback),
+ cb_dispatcher ](auto channel) mutable {
zx::socket s = l2cap_socket_factory_->MakeSocketForChannel(channel);
// Called every time the service is connected, cb must be shared.
async::PostTask(cb_dispatcher,
diff --git a/src/connectivity/bluetooth/core/bt-host/data/fake_domain.cc b/src/connectivity/bluetooth/core/bt-host/data/fake_domain.cc
index 9c2a3e3..123ae7a 100644
--- a/src/connectivity/bluetooth/core/bt-host/data/fake_domain.cc
+++ b/src/connectivity/bluetooth/core/bt-host/data/fake_domain.cc
@@ -164,9 +164,8 @@
void FakeDomain::RegisterService(l2cap::PSM psm, SocketCallback socket_callback,
async_dispatcher_t* cb_dispatcher) {
RegisterService(
- psm,
- [this, psm, cb = std::move(socket_callback),
- cb_dispatcher](auto channel) mutable {
+ psm, [ this, cb = std::move(socket_callback),
+ cb_dispatcher ](auto channel) mutable {
zx::socket s = socket_factory_.MakeSocketForChannel(channel);
// Called every time the service is connected, cb must be shared.
async::PostTask(cb_dispatcher,
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/adapter.cc b/src/connectivity/bluetooth/core/bt-host/gap/adapter.cc
index 5bfb04a..b6dd6d7 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/adapter.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/adapter.cc
@@ -247,7 +247,7 @@
->class_of_device = dev_class;
hci_->command_channel()->SendCommand(
std::move(write_dev_class), dispatcher_,
- [this, cb = std::move(callback)](auto, const hci::EventPacket& event) {
+ [cb = std::move(callback)](auto, const hci::EventPacket& event) {
hci_is_error(event, WARN, "gap", "set device class failed");
cb(event.ToStatus());
});
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/adapter_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gap/adapter_unittest.cc
index eb34b55..644630c 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/adapter_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/adapter_unittest.cc
@@ -80,7 +80,7 @@
TEST_F(GAP_AdapterTest, InitializeFailureNoFeaturesSupported) {
bool success;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -95,7 +95,7 @@
TEST_F(GAP_AdapterTest, InitializeFailureNoBufferInfo) {
bool success;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -115,7 +115,7 @@
TEST_F(GAP_AdapterTest, InitializeNoBREDR) {
bool success;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -142,7 +142,7 @@
TEST_F(GAP_AdapterTest, InitializeSuccess) {
bool success;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -168,7 +168,7 @@
TEST_F(GAP_AdapterTest, InitializeFailureHCICommandError) {
bool success;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -190,7 +190,7 @@
TEST_F(GAP_AdapterTest, TransportClosedCallback) {
bool success;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -218,7 +218,7 @@
bool success;
hci::Status result;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
@@ -249,7 +249,7 @@
bool success;
hci::Status result;
int init_cb_count = 0;
- auto init_cb = [&, this](bool cb_success) {
+ auto init_cb = [&](bool cb_success) {
success = cb_success;
init_cb_count++;
};
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/bredr_connection_manager.cc b/src/connectivity/bluetooth/core/bt-host/gap/bredr_connection_manager.cc
index 42e1e17..1319c01 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/bredr_connection_manager.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/bredr_connection_manager.cc
@@ -47,7 +47,7 @@
->scan_enable = scan_type;
hci->command_channel()->SendCommand(
std::move(write_enable), dispatcher,
- [cb = std::move(finish_cb), enabled](
+ [cb = std::move(finish_cb)](
auto, const hci::EventPacket& event) { cb(event.ToStatus()); });
};
hci->command_channel()->SendCommand(std::move(read_enable), dispatcher,
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager.cc b/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager.cc
index 996d4d1..f2a9f42 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager.cc
@@ -439,7 +439,7 @@
resolve_pending.cancel();
self->hci_->command_channel()->SendCommand(
std::move(write_enable), self->dispatcher_,
- [self, enable](auto, const hci::EventPacket& event) {
+ [self](auto, const hci::EventPacket& event) {
if (!self) {
return;
}
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager_unittest.cc
index ab68920..1231817 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/bredr_discovery_manager_unittest.cc
@@ -519,7 +519,7 @@
std::unique_ptr<BrEdrDiscoverySession> session;
discovery_manager()->RequestDiscovery(
- [&session](auto status, auto cb_session) {
+ [](auto status, auto cb_session) {
EXPECT_FALSE(status);
EXPECT_FALSE(cb_session);
EXPECT_EQ(HostError::kProtocolError, status.error());
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_advertising_manager_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_advertising_manager_unittest.cc
index ed3cc64..c898d0d 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_advertising_manager_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_advertising_manager_unittest.cc
@@ -332,7 +332,7 @@
AdvertisingData fake_ad = CreateFakeAdvertisingData();
AdvertisingData scan_rsp;
- auto connect_cb = [this](AdvertisementId connected_id,
+ auto connect_cb = [](AdvertisementId connected_id,
hci::ConnectionPtr conn) {};
adv_mgr()->StartAdvertising(fake_ad, scan_rsp, connect_cb, kTestInterval,
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager.cc b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager.cc
index 61bb183..a36ec8e 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager.cc
@@ -172,7 +172,7 @@
bt_log(TRACE, "gap-le", "received security upgrade request");
- pairing_->UpgradeSecurity(level, [handle, cb = std::move(callback)](
+ pairing_->UpgradeSecurity(level, [cb = std::move(callback)](
sm::Status status, const auto& sp) {
bt_log(INFO, "gap-le", "pairing status: %s, properties: %s",
status.ToString().c_str(), sp.ToString().c_str());
@@ -967,7 +967,7 @@
event_params->minimum_ce_length = 0x0000;
event_params->maximum_ce_length = 0x0000;
- auto status_cb = [handle](auto id, const hci::EventPacket& event) {
+ auto status_cb = [](auto id, const hci::EventPacket& event) {
ZX_DEBUG_ASSERT(event.event_code() == hci::kCommandStatusEventCode);
// Warn if the command failed.
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager_unittest.cc
index 7040bbf..fafd551 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_connection_manager_unittest.cc
@@ -403,8 +403,8 @@
EXPECT_FALSE(deleted);
};
- auto success_cb = [&conn_ref, &closed_cb, this](auto status,
- auto cb_conn_ref) {
+ auto success_cb = [&conn_ref, &closed_cb](auto status,
+ auto cb_conn_ref) {
EXPECT_TRUE(status);
ASSERT_TRUE(cb_conn_ref);
conn_ref = std::move(cb_conn_ref);
@@ -681,7 +681,7 @@
// of destruction.
LowEnergyConnectionRefPtr conn_ref;
- auto success_cb = [&conn_ref, this](auto status, auto cb_conn_ref) {
+ auto success_cb = [&conn_ref](auto status, auto cb_conn_ref) {
EXPECT_TRUE(cb_conn_ref);
EXPECT_TRUE(status);
@@ -732,7 +732,7 @@
auto closed_cb = [&closed_count] { closed_count++; };
std::vector<LowEnergyConnectionRefPtr> conn_refs;
- auto success_cb = [&conn_refs, &closed_cb, this](auto status, auto conn_ref) {
+ auto success_cb = [&conn_refs, &closed_cb](auto status, auto conn_ref) {
EXPECT_TRUE(status);
ASSERT_TRUE(conn_ref);
conn_ref->set_closed_callback(closed_cb);
@@ -763,10 +763,10 @@
test_device()->AddPeer(std::make_unique<FakePeer>(kAddress0));
int closed_count = 0;
- auto closed_cb = [&closed_count, this] { closed_count++; };
+ auto closed_cb = [&closed_count] { closed_count++; };
std::vector<LowEnergyConnectionRefPtr> conn_refs;
- auto success_cb = [&conn_refs, &closed_cb, this](auto status, auto conn_ref) {
+ auto success_cb = [&conn_refs, &closed_cb](auto status, auto conn_ref) {
EXPECT_TRUE(status);
ASSERT_TRUE(conn_ref);
conn_ref->set_closed_callback(closed_cb);
@@ -794,7 +794,7 @@
test_device()->AddPeer(std::make_unique<FakePeer>(kAddress0));
LowEnergyConnectionRefPtr conn_ref;
- auto success_cb = [&conn_ref, this](auto status, auto cb_conn_ref) {
+ auto success_cb = [&conn_ref](auto status, auto cb_conn_ref) {
EXPECT_TRUE(status);
ASSERT_TRUE(cb_conn_ref);
EXPECT_TRUE(cb_conn_ref->active());
@@ -828,7 +828,7 @@
test_device()->AddPeer(std::make_unique<FakePeer>(kAddress0));
LowEnergyConnectionRefPtr conn_ref;
- auto success_cb = [&conn_ref, this](auto status, auto cb_conn_ref) {
+ auto success_cb = [&conn_ref](auto status, auto cb_conn_ref) {
ASSERT_TRUE(cb_conn_ref);
ASSERT_TRUE(status);
EXPECT_TRUE(cb_conn_ref->active());
diff --git a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_discovery_manager_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_discovery_manager_unittest.cc
index 58a4930..d4c7f6a 100644
--- a/src/connectivity/bluetooth/core/bt-host/gap/low_energy_discovery_manager_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gap/low_energy_discovery_manager_unittest.cc
@@ -218,7 +218,7 @@
TEST_F(GAP_LowEnergyDiscoveryManagerTest, StartDiscoveryAndStop) {
std::unique_ptr<LowEnergyDiscoverySession> session;
discovery_manager()->StartDiscovery(
- [this, &session](auto cb_session) { session = std::move(cb_session); });
+ [&session](auto cb_session) { session = std::move(cb_session); });
RunLoopUntilIdle();
@@ -242,7 +242,7 @@
// should immediately terminate the session.
std::unique_ptr<LowEnergyDiscoverySession> session;
discovery_manager()->StartDiscovery(
- [this, &session](auto cb_session) { session = std::move(cb_session); });
+ [&session](auto cb_session) { session = std::move(cb_session); });
RunLoopUntilIdle();
@@ -265,7 +265,7 @@
// session is inactive with the error callback called.
std::unique_ptr<LowEnergyDiscoverySession> session;
discovery_manager()->StartDiscovery(
- [this, &session](auto cb_session) { session = std::move(cb_session); });
+ [&session](auto cb_session) { session = std::move(cb_session); });
RunLoopUntilIdle();
@@ -311,7 +311,7 @@
constexpr size_t kExpectedSessionCount = 5;
size_t cb_count = 0u;
- auto cb = [this, &cb_count, &sessions](auto session) {
+ auto cb = [&cb_count, &sessions](auto session) {
sessions.push_back(std::move(session));
cb_count++;
};
@@ -354,7 +354,7 @@
constexpr size_t kExpectedSessionCount = 5;
size_t cb_count = 0u;
- auto cb = [this, &cb_count, &sessions](auto session) {
+ auto cb = [&cb_count, &sessions](auto session) {
sessions.push_back(std::move(session));
cb_count++;
};
@@ -378,7 +378,7 @@
constexpr size_t kExpectedSessionCount = 5;
size_t cb_count = 0u;
std::unique_ptr<LowEnergyDiscoverySession> session;
- auto cb = [this, &cb_count, &session](auto cb_session) {
+ auto cb = [&cb_count, &session](auto cb_session) {
cb_count++;
if (cb_count == kExpectedSessionCount) {
// Hold on to only the last session object. The rest should get deleted
@@ -409,7 +409,7 @@
std::unique_ptr<LowEnergyDiscoverySession> session;
discovery_manager()->StartDiscovery(
- [this, &session](auto cb_session) { session = std::move(cb_session); });
+ [&session](auto cb_session) { session = std::move(cb_session); });
RunLoopUntilIdle();
EXPECT_TRUE(scan_enabled());
@@ -422,7 +422,7 @@
// Request a new session. The discovery manager should restart the scan after
// the ongoing one stops.
discovery_manager()->StartDiscovery(
- [this, &session](auto cb_session) { session = std::move(cb_session); });
+ [&session](auto cb_session) { session = std::move(cb_session); });
// Discovery should stop and start again.
RunLoopUntilIdle();
@@ -438,7 +438,7 @@
constexpr size_t kExpectedSessionCount = 5;
size_t cb_count = 0u;
- auto cb = [this, &cb_count](auto session) {
+ auto cb = [&cb_count](auto session) {
// |session| should contain nullptr as the request will fail.
EXPECT_FALSE(session);
cb_count++;
@@ -483,7 +483,7 @@
discovery_manager()->StartDiscovery([&](auto cb_session) {
session = std::move(cb_session);
session->set_error_callback(
- [&session_error, this] { session_error = true; });
+ [&session_error] { session_error = true; });
});
// The controller will fail to restart scanning after scanning stops at the
@@ -722,7 +722,7 @@
// Session 0 is interested in performing general discovery.
std::unordered_set<DeviceAddress> peers_session0;
LowEnergyDiscoverySession::PeerFoundCallback result_cb =
- [this, &peers_session0](const auto& peer) {
+ [&peers_session0](const auto& peer) {
peers_session0.insert(peer.address());
};
sessions.push_back(StartDiscoverySession());
diff --git a/src/connectivity/bluetooth/core/bt-host/gatt/client.cc b/src/connectivity/bluetooth/core/bt-host/gatt/client.cc
index ca503f1..b4135a6 100644
--- a/src/connectivity/bluetooth/core/bt-host/gatt/client.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gatt/client.cc
@@ -298,8 +298,8 @@
});
auto error_cb =
- BindErrorCallback([this, res_cb = status_callback.share()](
- att::Status status, att::Handle handle) {
+ BindErrorCallback([res_cb = status_callback.share()](
+ att::Status status, att::Handle handle) {
// An Error Response code of "Attribute Not Found" indicates the end
// of the procedure (v5.0, Vol 3, Part G, 4.4.1).
if (status.is_protocol_error() &&
@@ -451,8 +451,8 @@
});
auto error_cb =
- BindErrorCallback([this, res_cb = status_callback.share()](
- att::Status status, att::Handle handle) {
+ BindErrorCallback([res_cb = status_callback.share()](
+ att::Status status, att::Handle handle) {
// An Error Response code of "Attribute Not Found" indicates the end
// of the procedure (v5.0, Vol 3, Part G, 4.6.1).
if (status.is_protocol_error() &&
@@ -538,8 +538,8 @@
});
auto error_cb =
- BindErrorCallback([this, res_cb = status_callback.share()](
- att::Status status, att::Handle handle) {
+ BindErrorCallback([res_cb = status_callback.share()](
+ att::Status status, att::Handle handle) {
// An Error Response code of "Attribute Not Found" indicates the end
// of the procedure (v5.0, Vol 3, Part G, 4.7.1).
if (status.is_protocol_error() &&
@@ -566,15 +566,15 @@
auto params = writer.mutable_payload<att::ReadRequestParams>();
params->handle = htole16(handle);
- auto rsp_cb = BindCallback(
- [this, callback = callback.share()](const att::PacketReader& rsp) {
- ZX_DEBUG_ASSERT(rsp.opcode() == att::kReadResponse);
- callback(att::Status(), rsp.payload_data());
- });
+ auto rsp_cb = BindCallback([callback = callback.share()](
+ const att::PacketReader& rsp) {
+ ZX_DEBUG_ASSERT(rsp.opcode() == att::kReadResponse);
+ callback(att::Status(), rsp.payload_data());
+ });
auto error_cb =
- BindErrorCallback([this, callback = callback.share()](
- att::Status status, att::Handle handle) {
+ BindErrorCallback([callback = callback.share()](att::Status status,
+ att::Handle handle) {
bt_log(TRACE, "gatt", "read request failed: %s, handle %#.4x",
status.ToString().c_str(), handle);
callback(status, BufferView());
@@ -599,15 +599,15 @@
params->handle = htole16(handle);
params->offset = htole16(offset);
- auto rsp_cb = BindCallback(
- [this, callback = callback.share()](const att::PacketReader& rsp) {
- ZX_DEBUG_ASSERT(rsp.opcode() == att::kReadBlobResponse);
- callback(att::Status(), rsp.payload_data());
- });
+ auto rsp_cb = BindCallback([callback = callback.share()](
+ const att::PacketReader& rsp) {
+ ZX_DEBUG_ASSERT(rsp.opcode() == att::kReadBlobResponse);
+ callback(att::Status(), rsp.payload_data());
+ });
auto error_cb =
- BindErrorCallback([this, callback = callback.share()](
- att::Status status, att::Handle handle) {
+ BindErrorCallback([callback = callback.share()](att::Status status,
+ att::Handle handle) {
bt_log(TRACE, "gatt", "read blob request failed: %s, handle: %#.4x",
status.ToString().c_str(), handle);
callback(status, BufferView());
@@ -656,8 +656,8 @@
});
auto error_cb =
- BindErrorCallback([this, callback = callback.share()](
- att::Status status, att::Handle handle) {
+ BindErrorCallback([callback = callback.share()](att::Status status,
+ att::Handle handle) {
bt_log(TRACE, "gatt", "write request failed: %s, handle: %#.2x",
status.ToString().c_str(), handle);
callback(status);
diff --git a/src/connectivity/bluetooth/core/bt-host/gatt/client_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gatt/client_unittest.cc
index 69fd36c..ed0bfb4 100644
--- a/src/connectivity/bluetooth/core/bt-host/gatt/client_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gatt/client_unittest.cc
@@ -93,7 +93,7 @@
// Initialize to a non-zero value.
uint16_t final_mtu = kPreferredMTU;
att::Status status;
- auto mtu_cb = [&, this](att::Status cb_status, uint16_t val) {
+ auto mtu_cb = [&](att::Status cb_status, uint16_t val) {
final_mtu = val;
status = cb_status;
};
@@ -132,7 +132,7 @@
uint16_t final_mtu = 0;
att::Status status;
- auto mtu_cb = [&, this](att::Status cb_status, uint16_t val) {
+ auto mtu_cb = [&](att::Status cb_status, uint16_t val) {
final_mtu = val;
status = cb_status;
};
@@ -174,7 +174,7 @@
uint16_t final_mtu = kPreferredMTU;
att::Status status;
- auto mtu_cb = [&, this](att::Status cb_status, uint16_t val) {
+ auto mtu_cb = [&](att::Status cb_status, uint16_t val) {
final_mtu = val;
status = cb_status;
};
@@ -214,7 +214,7 @@
uint16_t final_mtu = 0;
att::Status status;
- auto mtu_cb = [&, this](att::Status cb_status, uint16_t val) {
+ auto mtu_cb = [&](att::Status cb_status, uint16_t val) {
final_mtu = val;
status = cb_status;
};
@@ -253,7 +253,7 @@
uint16_t final_mtu = 0;
att::Status status;
- auto mtu_cb = [&, this](att::Status cb_status, uint16_t val) {
+ auto mtu_cb = [&](att::Status cb_status, uint16_t val) {
final_mtu = val;
status = cb_status;
};
@@ -292,7 +292,7 @@
uint16_t final_mtu = 0;
att::Status status;
- auto mtu_cb = [&, this](att::Status cb_status, uint16_t val) {
+ auto mtu_cb = [&](att::Status cb_status, uint16_t val) {
final_mtu = val;
status = cb_status;
};
@@ -321,7 +321,7 @@
TEST_F(GATT_ClientTest, DiscoverAllPrimaryResponseTooShort) {
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -340,7 +340,7 @@
TEST_F(GATT_ClientTest, DiscoverAllPrimaryMalformedDataLength) {
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -365,7 +365,7 @@
TEST_F(GATT_ClientTest, DiscoverAllPrimaryMalformedAttrDataList) {
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -391,7 +391,7 @@
// an empty data list as not an error.
TEST_F(GATT_ClientTest, DiscoverAllPrimaryEmptyDataList) {
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -413,7 +413,7 @@
// The first request results in "Attribute Not Found".
TEST_F(GATT_ClientTest, DiscoverAllPrimaryAttributeNotFound) {
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -438,7 +438,7 @@
// The first request results in an error.
TEST_F(GATT_ClientTest, DiscoverAllPrimaryError) {
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -462,7 +462,7 @@
TEST_F(GATT_ClientTest, DiscoverAllPrimaryMalformedServiceRange) {
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the loop since Expect() below blocks.
async::PostTask(dispatcher(), [this, res_cb] {
@@ -489,7 +489,7 @@
TEST_F(GATT_ClientTest, DiscoverAllPrimary16BitResultsSingleRequest) {
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<ServiceData> services;
auto svc_cb = [&services](const ServiceData& svc) {
@@ -530,7 +530,7 @@
TEST_F(GATT_ClientTest, DiscoverAllPrimary128BitResultSingleRequest) {
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<ServiceData> services;
auto svc_cb = [&services](const ServiceData& svc) {
@@ -585,7 +585,7 @@
);
att::Status status(HostError::kFailed);
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<ServiceData> services;
auto svc_cb = [&services](const ServiceData& svc) {
@@ -662,7 +662,7 @@
constexpr att::Handle kEnd = 0x0001;
att::Status status(HostError::kFailed); // Initialize as error
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Should succeed immediately.
client()->DiscoverCharacteristics(kStart, kEnd, NopChrcCallback, res_cb);
@@ -681,7 +681,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the message loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -710,7 +710,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the message loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -745,7 +745,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the message loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -781,7 +781,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the message loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -813,7 +813,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the message loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -847,7 +847,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
// Initiate the request on the message loop since Expect() below blocks.
async::PostTask(dispatcher(), [&, this] {
@@ -881,7 +881,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
@@ -934,7 +934,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
@@ -992,7 +992,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
@@ -1082,7 +1082,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
@@ -1125,7 +1125,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
@@ -1168,7 +1168,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
@@ -1209,7 +1209,7 @@
);
att::Status status;
- auto res_cb = [this, &status](att::Status val) { status = val; };
+ auto res_cb = [&status](att::Status val) { status = val; };
std::vector<CharacteristicData> chrcs;
auto chrc_cb = [&chrcs](const CharacteristicData& chrc) {
diff --git a/src/connectivity/bluetooth/core/bt-host/gatt/remote_service_manager_unittest.cc b/src/connectivity/bluetooth/core/bt-host/gatt/remote_service_manager_unittest.cc
index 9a92e38..8f3e025 100644
--- a/src/connectivity/bluetooth/core/bt-host/gatt/remote_service_manager_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gatt/remote_service_manager_unittest.cc
@@ -148,7 +148,7 @@
[&services](auto svc) { services.push_back(svc); });
att::Status status(HostError::kFailed);
- mgr()->Initialize([this, &status](att::Status val) { status = val; });
+ mgr()->Initialize([&status](att::Status val) { status = val; });
RunLoopUntilIdle();
@@ -173,7 +173,7 @@
[&services](auto svc) { services.push_back(svc); });
att::Status status(HostError::kFailed);
- mgr()->Initialize([this, &status](att::Status val) { status = val; });
+ mgr()->Initialize([&status](att::Status val) { status = val; });
RunLoopUntilIdle();
@@ -201,7 +201,7 @@
ASSERT_TRUE(services.empty());
att::Status status(HostError::kFailed);
- mgr()->Initialize([this, &status](att::Status val) { status = val; });
+ mgr()->Initialize([&status](att::Status val) { status = val; });
RunLoopUntilIdle();
@@ -225,7 +225,7 @@
EXPECT_TRUE(services.empty());
att::Status status(HostError::kFailed);
- mgr()->Initialize([this, &status](att::Status val) { status = val; });
+ mgr()->Initialize([&status](att::Status val) { status = val; });
RunLoopUntilIdle();
@@ -241,7 +241,7 @@
fake_client()->set_primary_services(std::move(fake_services));
att::Status status(HostError::kFailed);
- mgr()->Initialize([this, &status](att::Status val) { status = val; });
+ mgr()->Initialize([&status](att::Status val) { status = val; });
RunLoopUntilIdle();
@@ -277,7 +277,7 @@
ASSERT_TRUE(services.empty());
att::Status status(HostError::kFailed);
- mgr()->Initialize([this, &status](att::Status val) { status = val; });
+ mgr()->Initialize([&status](att::Status val) { status = val; });
RunLoopUntilIdle();
diff --git a/src/connectivity/bluetooth/core/bt-host/gatt/server.cc b/src/connectivity/bluetooth/core/bt-host/gatt/server.cc
index dd19257..f40667d 100644
--- a/src/connectivity/bluetooth/core/bt-host/gatt/server.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gatt/server.cc
@@ -405,8 +405,8 @@
att::Handle handle = results.front()->handle();
auto self = weak_ptr_factory_.GetWeakPtr();
- auto result_cb = [self, tid, handle, kMaxValueSize, kHeaderSize](
- att::ErrorCode ecode, const auto& value) {
+ auto result_cb = [self, tid, handle, kMaxValueSize](att::ErrorCode ecode,
+ const auto& value) {
if (!self)
return;
@@ -493,8 +493,7 @@
constexpr size_t kHeaderSize = sizeof(att::Header);
auto self = weak_ptr_factory_.GetWeakPtr();
- auto callback = [self, tid, offset, handle](att::ErrorCode ecode,
- const auto& value) {
+ auto callback = [self, tid, handle](att::ErrorCode ecode, const auto& value) {
if (!self)
return;
diff --git a/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc b/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc
index d47c43f..54e73ce 100644
--- a/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc
@@ -318,7 +318,7 @@
bt_gatt_id_t id, const bt_gatt_notification_value_t* value,
bt_gatt_svc_enable_notifications_callback status_cb, void* cookie) {
auto value_cb = *value;
- auto notif_callback = [cookie, id, value_cb](const ByteBuffer& buff) {
+ auto notif_callback = [id, value_cb](const ByteBuffer& buff) {
value_cb.callback(value_cb.ctx, id, buff.data(), buff.size());
};
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/acl_data_channel_unittest.cc b/src/connectivity/bluetooth/core/bt-host/hci/acl_data_channel_unittest.cc
index 62d8ccd..bfe0dd6f 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/acl_data_channel_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/acl_data_channel_unittest.cc
@@ -670,7 +670,7 @@
InitializeACLDataChannel(DataBufferInfo(1u, 1u), DataBufferInfo(1u, 1u));
bool closed_cb_called = false;
- auto closed_cb = [&closed_cb_called, this] { closed_cb_called = true; };
+ auto closed_cb = [&closed_cb_called] { closed_cb_called = true; };
transport()->SetTransportClosedCallback(closed_cb, dispatcher());
async::PostTask(dispatcher(),
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/command_channel_unittest.cc b/src/connectivity/bluetooth/core/bt-host/hci/command_channel_unittest.cc
index cc5235fb4..3674762 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/command_channel_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/command_channel_unittest.cc
@@ -72,8 +72,8 @@
auto reset = CommandPacket::New(kReset);
CommandChannel::TransactionId id = cmd_channel()->SendCommand(
std::move(reset), dispatcher(),
- [&id, this, test_obj](CommandChannel::TransactionId callback_id,
- const EventPacket& event) {
+ [&id, test_obj](CommandChannel::TransactionId callback_id,
+ const EventPacket& event) {
EXPECT_EQ(id, callback_id);
EXPECT_EQ(kCommandCompleteEventCode, event.event_code());
EXPECT_EQ(4, event.view().header().parameter_total_size);
@@ -128,8 +128,8 @@
// Send HCI_Inquiry
CommandChannel::TransactionId id;
int cb_count = 0;
- auto cb = [&cb_count, &id, this](CommandChannel::TransactionId callback_id,
- const EventPacket& event) {
+ auto cb = [&cb_count, &id](CommandChannel::TransactionId callback_id,
+ const EventPacket& event) {
cb_count++;
EXPECT_EQ(callback_id, id);
if (cb_count == 1) {
@@ -176,8 +176,8 @@
// Send HCI_Reset
CommandChannel::TransactionId id;
- auto complete_cb = [&id, this](CommandChannel::TransactionId callback_id,
- const EventPacket& event) {
+ auto complete_cb = [&id](CommandChannel::TransactionId callback_id,
+ const EventPacket& event) {
EXPECT_EQ(callback_id, id);
EXPECT_EQ(kCommandStatusEventCode, event.event_code());
EXPECT_EQ(StatusCode::kSuccess,
@@ -524,9 +524,8 @@
CommandChannel::TransactionId id;
size_t cb_count = 0;
- auto cb = [&cb_count, &id, kTestEventCode0, this](
- CommandChannel::TransactionId callback_id,
- const EventPacket& event) {
+ auto cb = [&cb_count, &id, kTestEventCode0](
+ CommandChannel::TransactionId callback_id, const EventPacket& event) {
cb_count++;
EXPECT_EQ(callback_id, id);
if (cb_count == 1) {
@@ -586,15 +585,19 @@
};
int event_count1 = 0;
- auto event_cb1 = [&event_count1, kTestEventCode0,
- this](const EventPacket& event) {
+ auto event_cb1 = [
+ &event_count1,
+ kTestEventCode0
+ ](const EventPacket& event) {
event_count1++;
EXPECT_EQ(kTestEventCode0, event.event_code());
};
int event_count2 = 0;
- auto event_cb2 = [&event_count2, kTestEventCode1,
- this](const EventPacket& event) {
+ auto event_cb2 = [
+ &event_count2,
+ kTestEventCode1
+ ](const EventPacket& event) {
event_count2++;
EXPECT_EQ(kTestEventCode1, event.event_code());
};
@@ -709,8 +712,10 @@
StartTestDevice();
int event_count = 0;
- auto event_cb = [&event_count, kTestEventCode,
- this](const EventPacket& event) {
+ auto event_cb = [
+ &event_count,
+ kTestEventCode
+ ](const EventPacket& event) {
event_count++;
EXPECT_EQ(kTestEventCode, event.event_code());
EXPECT_EQ(1u, event.view().header().parameter_total_size);
@@ -742,8 +747,10 @@
CreateStaticByteBuffer(hci::kLEMetaEventCode, 0x01, kTestSubeventCode1);
int event_count0 = 0;
- auto event_cb0 = [&event_count0, kTestSubeventCode0,
- this](const EventPacket& event) {
+ auto event_cb0 = [
+ &event_count0,
+ kTestSubeventCode0
+ ](const EventPacket& event) {
event_count0++;
EXPECT_EQ(hci::kLEMetaEventCode, event.event_code());
EXPECT_EQ(kTestSubeventCode0,
@@ -751,8 +758,10 @@
};
int event_count1 = 0;
- auto event_cb1 = [&event_count1, kTestSubeventCode1,
- this](const EventPacket& event) {
+ auto event_cb1 = [
+ &event_count1,
+ kTestSubeventCode1
+ ](const EventPacket& event) {
event_count1++;
EXPECT_EQ(hci::kLEMetaEventCode, event.event_code());
EXPECT_EQ(kTestSubeventCode1,
@@ -913,7 +922,7 @@
StartTestDevice();
bool closed_cb_called = false;
- auto closed_cb = [&closed_cb_called, this] { closed_cb_called = true; };
+ auto closed_cb = [&closed_cb_called] { closed_cb_called = true; };
transport()->SetTransportClosedCallback(closed_cb, dispatcher());
async::PostTask(dispatcher(),
@@ -937,9 +946,8 @@
size_t cb_count = 0;
CommandChannel::TransactionId id1, id2;
- auto cb = [&cb_count, &id1, &id2, this](
- CommandChannel::TransactionId callback_id,
- const EventPacket& event) {
+ auto cb = [&cb_count, &id1, &id2](CommandChannel::TransactionId callback_id,
+ const EventPacket& event) {
cb_count++;
EXPECT_TRUE(callback_id == id1 || callback_id == id2);
EXPECT_EQ(kCommandStatusEventCode, event.event_code());
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/connection_unittest.cc b/src/connectivity/bluetooth/core/bt-host/hci/connection_unittest.cc
index 14a6322..c378508 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/connection_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/connection_unittest.cc
@@ -118,7 +118,7 @@
bool callback_called = false;
test_device()->SetTransactionCallback(
- [&callback_called, this] { callback_called = true; }, dispatcher());
+ [&callback_called] { callback_called = true; }, dispatcher());
auto connection = NewConnection();
EXPECT_TRUE(connection->is_open());
@@ -153,7 +153,7 @@
// The callback should get called regardless of the procedure status.
bool callback_called = false;
test_device()->SetTransactionCallback(
- [&callback_called, this] { callback_called = true; }, dispatcher());
+ [&callback_called] { callback_called = true; }, dispatcher());
auto connection = NewConnection();
EXPECT_TRUE(connection->is_open());
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/legacy_low_energy_scanner_unittest.cc b/src/connectivity/bluetooth/core/bt-host/hci/legacy_low_energy_scanner_unittest.cc
index 3a6e27a..8657e40 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/legacy_low_energy_scanner_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/legacy_low_energy_scanner_unittest.cc
@@ -312,7 +312,7 @@
AddFakePeers();
std::map<DeviceAddress, std::pair<LowEnergyScanResult, std::string>> results;
- set_peer_found_callback([&, this](const auto& result, const auto& data) {
+ set_peer_found_callback([&](const auto& result, const auto& data) {
results[result.address] = std::make_pair(result, data.ToString());
});
@@ -416,7 +416,7 @@
std::map<DeviceAddress, std::pair<LowEnergyScanResult, std::string>> results;
set_peer_found_callback(
- [&results, this](const auto& result, const auto& data) {
+ [&results](const auto& result, const auto& data) {
results[result.address] = std::make_pair(result, data.ToString());
});
@@ -450,7 +450,7 @@
AddFakePeers();
std::map<DeviceAddress, std::pair<LowEnergyScanResult, std::string>> results;
- set_peer_found_callback([&, this](const auto& result, const auto& data) {
+ set_peer_found_callback([&](const auto& result, const auto& data) {
results[result.address] = std::make_pair(result, data.ToString());
});
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/low_energy_connector_unittest.cc b/src/connectivity/bluetooth/core/bt-host/hci/low_energy_connector_unittest.cc
index 8b8c734..3e2954a 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/low_energy_connector_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/low_energy_connector_unittest.cc
@@ -115,7 +115,7 @@
ConnectionPtr conn;
bool callback_called = false;
- auto callback = [&, this](auto cb_status, auto cb_conn) {
+ auto callback = [&](auto cb_status, auto cb_conn) {
status = cb_status;
conn = std::move(cb_conn);
callback_called = true;
@@ -159,7 +159,7 @@
ConnectionPtr conn;
bool callback_called = false;
- auto callback = [&, this](auto cb_status, auto cb_conn) {
+ auto callback = [&](auto cb_status, auto cb_conn) {
status = cb_status;
conn = std::move(cb_conn);
callback_called = true;
@@ -194,7 +194,7 @@
ConnectionPtr conn;
bool callback_called = false;
- auto callback = [&, this](auto cb_status, auto cb_conn) {
+ auto callback = [&](auto cb_status, auto cb_conn) {
status = cb_status;
callback_called = true;
conn = std::move(cb_conn);
@@ -229,7 +229,7 @@
ConnectionPtr conn;
bool callback_called = false;
- auto callback = [&, this](auto cb_status, auto cb_conn) {
+ auto callback = [&](auto cb_status, auto cb_conn) {
status = cb_status;
callback_called = true;
conn = std::move(cb_conn);
@@ -303,7 +303,7 @@
ConnectionPtr conn;
unsigned int callback_count = 0;
- auto callback = [&, this](auto cb_status, auto cb_conn) {
+ auto callback = [&](auto cb_status, auto cb_conn) {
status = cb_status;
callback_count++;
conn = std::move(cb_conn);
@@ -354,7 +354,7 @@
ConnectionPtr conn;
bool callback_called = false;
- auto callback = [&, this](auto cb_status, auto cb_conn) {
+ auto callback = [&](auto cb_status, auto cb_conn) {
status = cb_status;
callback_called = true;
conn = std::move(cb_conn);
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/sequential_command_runner_unittest.cc b/src/connectivity/bluetooth/core/bt-host/hci/sequential_command_runner_unittest.cc
index 3702b54..9e0a43d 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/sequential_command_runner_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/sequential_command_runner_unittest.cc
@@ -91,7 +91,7 @@
Status status;
int status_cb_called = 0;
- auto status_cb = [&, this](Status cb_status) {
+ auto status_cb = [&](Status cb_status) {
status = cb_status;
status_cb_called++;
};
@@ -228,7 +228,7 @@
Status status;
int status_cb_called = 0;
- auto status_cb = [&, this](Status cb_status) {
+ auto status_cb = [&](Status cb_status) {
status = cb_status;
status_cb_called++;
};
diff --git a/src/connectivity/bluetooth/core/bt-host/hci/transport.cc b/src/connectivity/bluetooth/core/bt-host/hci/transport.cc
index bc0c37e..dab995b 100644
--- a/src/connectivity/bluetooth/core/bt-host/hci/transport.cc
+++ b/src/connectivity/bluetooth/core/bt-host/hci/transport.cc
@@ -147,17 +147,17 @@
void Transport::WatchChannelClosed(const zx::channel& channel,
Waiter& wait) {
- async::PostTask(io_dispatcher_,
- [handle = channel.get(), &wait, this, ref = fxl::Ref(this)] {
- wait.set_object(handle);
- wait.set_trigger(ZX_CHANNEL_PEER_CLOSED);
- zx_status_t status = wait.Begin(async_get_default_dispatcher());
- if (status != ZX_OK) {
- bt_log(ERROR, "hci", "failed to set up closed handler: %s",
- zx_status_get_string(status));
- wait.set_object(ZX_HANDLE_INVALID);
- }
- });
+ async::PostTask(
+ io_dispatcher_, [ handle = channel.get(), &wait, ref = fxl::Ref(this) ] {
+ wait.set_object(handle);
+ wait.set_trigger(ZX_CHANNEL_PEER_CLOSED);
+ zx_status_t status = wait.Begin(async_get_default_dispatcher());
+ if (status != ZX_OK) {
+ bt_log(ERROR, "hci", "failed to set up closed handler: %s",
+ zx_status_get_string(status));
+ wait.set_object(ZX_HANDLE_INVALID);
+ }
+ });
}
void Transport::OnChannelClosed(
diff --git a/src/connectivity/bluetooth/core/bt-host/l2cap/channel_manager_unittest.cc b/src/connectivity/bluetooth/core/bt-host/l2cap/channel_manager_unittest.cc
index c7a9b5e..29f4f86 100644
--- a/src/connectivity/bluetooth/core/bt-host/l2cap/channel_manager_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/l2cap/channel_manager_unittest.cc
@@ -314,7 +314,7 @@
};
bool smp_cb_called = false;
- auto smp_rx_cb = [&smp_cb_called, this](ByteBufferPtr sdu) {
+ auto smp_rx_cb = [&smp_cb_called](ByteBufferPtr sdu) {
ZX_DEBUG_ASSERT(sdu);
EXPECT_EQ(0u, sdu->size());
smp_cb_called = true;
@@ -374,7 +374,7 @@
auto att_rx_cb = [&packet_count](ByteBufferPtr sdu) { packet_count++; };
bool smp_cb_called = false;
- auto smp_rx_cb = [&smp_cb_called, this](ByteBufferPtr sdu) {
+ auto smp_rx_cb = [&smp_cb_called](ByteBufferPtr sdu) {
ZX_DEBUG_ASSERT(sdu);
EXPECT_EQ(0u, sdu->size());
smp_cb_called = true;
@@ -432,7 +432,7 @@
auto att_rx_cb = [&packet_count](ByteBufferPtr sdu) { packet_count++; };
bool smp_cb_called = false;
- auto smp_rx_cb = [&smp_cb_called, this](ByteBufferPtr sdu) {
+ auto smp_rx_cb = [&smp_cb_called](ByteBufferPtr sdu) {
ZX_DEBUG_ASSERT(sdu);
EXPECT_EQ(0u, sdu->size());
smp_cb_called = true;
@@ -495,7 +495,7 @@
auto att_rx_cb = [&packet_count](ByteBufferPtr sdu) { packet_count++; };
bool smp_cb_called = false;
- auto smp_rx_cb = [&smp_cb_called, this](ByteBufferPtr sdu) {
+ auto smp_rx_cb = [&smp_cb_called](ByteBufferPtr sdu) {
ZX_DEBUG_ASSERT(sdu);
EXPECT_EQ(0u, sdu->size());
smp_cb_called = true;
@@ -741,7 +741,7 @@
TEST_F(L2CAP_ChannelManagerTest, LEChannelSignalLinkError) {
bool link_error = false;
- auto link_error_cb = [&link_error, this] { link_error = true; };
+ auto link_error_cb = [&link_error] { link_error = true; };
RegisterLE(kTestHandle1, hci::Connection::Role::kMaster, link_error_cb);
// Activate a new Attribute channel to signal the error.
@@ -757,7 +757,7 @@
TEST_F(L2CAP_ChannelManagerTest, ACLChannelSignalLinkError) {
bool link_error = false;
- auto link_error_cb = [&link_error, this] { link_error = true; };
+ auto link_error_cb = [&link_error] { link_error = true; };
RegisterACL(kTestHandle1, hci::Connection::Role::kMaster, link_error_cb);
// Activate a new Security Manager channel to signal the error.
@@ -773,7 +773,7 @@
TEST_F(L2CAP_ChannelManagerTest, LEConnectionParameterUpdateRequest) {
bool conn_param_cb_called = false;
- auto conn_param_cb = [&conn_param_cb_called, this](const auto& params) {
+ auto conn_param_cb = [&conn_param_cb_called](const auto& params) {
// The parameters should match the payload of the HCI packet seen below.
EXPECT_EQ(0x0006, params.min_interval());
EXPECT_EQ(0x0C80, params.max_interval());
diff --git a/src/connectivity/bluetooth/core/bt-host/l2cap/fake_channel_test.cc b/src/connectivity/bluetooth/core/bt-host/l2cap/fake_channel_test.cc
index 994d40f4..11ef53a 100644
--- a/src/connectivity/bluetooth/core/bt-host/l2cap/fake_channel_test.cc
+++ b/src/connectivity/bluetooth/core/bt-host/l2cap/fake_channel_test.cc
@@ -26,7 +26,7 @@
}
bool success = false;
- auto cb = [&expected, &success, this](auto cb_packet) {
+ auto cb = [&expected, &success](auto cb_packet) {
success = ContainersEqual(expected, *cb_packet);
};
diff --git a/src/connectivity/bluetooth/core/bt-host/l2cap/le_signaling_channel_unittest.cc b/src/connectivity/bluetooth/core/bt-host/l2cap/le_signaling_channel_unittest.cc
index 5113b75..bc4ce6b 100644
--- a/src/connectivity/bluetooth/core/bt-host/l2cap/le_signaling_channel_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/l2cap/le_signaling_channel_unittest.cc
@@ -295,13 +295,13 @@
// clang-format on
bool fake_chan_cb_called = false;
- auto fake_chan_cb = [&expected, &fake_chan_cb_called, this](auto packet) {
+ auto fake_chan_cb = [&expected, &fake_chan_cb_called](auto packet) {
EXPECT_TRUE(ContainersEqual(expected, *packet));
fake_chan_cb_called = true;
};
bool conn_param_cb_called = false;
- auto conn_param_cb = [&conn_param_cb_called, this](const auto& params) {
+ auto conn_param_cb = [&conn_param_cb_called](const auto& params) {
EXPECT_EQ(0x0006, params.min_interval());
EXPECT_EQ(0x0C80, params.max_interval());
EXPECT_EQ(0x01F3, params.max_latency());
@@ -341,7 +341,7 @@
// clang-format on
bool cb_called = false;
- auto cb = [&expected, &cb_called, this](auto packet) {
+ auto cb = [&expected, &cb_called](auto packet) {
EXPECT_TRUE(ContainersEqual(expected, *packet));
cb_called = true;
};
diff --git a/src/connectivity/bluetooth/core/bt-host/l2cap/signaling_channel_unittest.cc b/src/connectivity/bluetooth/core/bt-host/l2cap/signaling_channel_unittest.cc
index 9b73d78..445cadd 100644
--- a/src/connectivity/bluetooth/core/bt-host/l2cap/signaling_channel_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/l2cap/signaling_channel_unittest.cc
@@ -249,7 +249,7 @@
'L', 'O', 'L', 'Z');
bool called = false;
- sig()->set_packet_callback([&cmd, &called, this](auto packet) {
+ sig()->set_packet_callback([&cmd, &called](auto packet) {
EXPECT_TRUE(ContainersEqual(cmd, packet.data()));
called = true;
});
diff --git a/src/connectivity/bluetooth/core/bt-host/sdp/server_unittest.cc b/src/connectivity/bluetooth/core/bt-host/sdp/server_unittest.cc
index 2f3fe7a..f19ad42 100644
--- a/src/connectivity/bluetooth/core/bt-host/sdp/server_unittest.cc
+++ b/src/connectivity/bluetooth/core/bt-host/sdp/server_unittest.cc
@@ -67,7 +67,7 @@
}
bool success = false;
- auto cb = [&expected, &success, this](auto cb_packet) {
+ auto cb = [&expected, &success](auto cb_packet) {
success = ContainersEqual(expected, *cb_packet);
};
@@ -810,7 +810,7 @@
);
ServiceSearchAttributeResponse rsp;
- auto send_cb = [this, &rsp](auto cb_packet) {
+ auto send_cb = [&rsp](auto cb_packet) {
EXPECT_LE(sizeof(Header), cb_packet->size());
PacketView<sdp::Header> packet(cb_packet.get());
ASSERT_EQ(0x07, packet.header().pdu_id);
diff --git a/src/connectivity/bluetooth/tools/bt-intel-tool/command_channel.cc b/src/connectivity/bluetooth/tools/bt-intel-tool/command_channel.cc
index 91490d6..e2543e0 100644
--- a/src/connectivity/bluetooth/tools/bt-intel-tool/command_channel.cc
+++ b/src/connectivity/bluetooth/tools/bt-intel-tool/command_channel.cc
@@ -132,7 +132,7 @@
bool received = false;
auto previous_cb = std::move(event_callback_);
- auto cb = [this, &received,
+ auto cb = [&received,
callback = std::move(callback)](const auto& event_packet) {
if (callback) {
callback(event_packet);
diff --git a/src/connectivity/network/mdns/service/mdns_service_impl.cc b/src/connectivity/network/mdns/service/mdns_service_impl.cc
index 585ed77..3bdb85d 100644
--- a/src/connectivity/network/mdns/service/mdns_service_impl.cc
+++ b/src/connectivity/network/mdns/service/mdns_service_impl.cc
@@ -93,7 +93,7 @@
PublishServiceInstance(
publication.service_, publication.instance_,
publication.publication_->Clone(), true,
- [this, service = publication.service_](
+ [service = publication.service_](
fuchsia::net::mdns::Publisher_PublishServiceInstance_Result
result) {
if (result.is_err()) {
@@ -144,7 +144,7 @@
mdns_.ResolveHostName(
host, fxl::TimePoint::Now() + fxl::TimeDelta::FromNanoseconds(timeout_ns),
- [this, callback = std::move(callback)](
+ [callback = std::move(callback)](
const std::string& host, const inet::IpAddress& v4_address,
const inet::IpAddress& v6_address) {
callback(v4_address ? std::make_unique<fuchsia::net::Ipv4Address>(
diff --git a/src/connectivity/network/mdns/service/resource_renewer.h b/src/connectivity/network/mdns/service/resource_renewer.h
index 6c0b2e1b..6b74fd9 100644
--- a/src/connectivity/network/mdns/service/resource_renewer.h
+++ b/src/connectivity/network/mdns/service/resource_renewer.h
@@ -89,7 +89,7 @@
};
struct Hash {
- size_t operator()(const std::unique_ptr<Entry>& m) {
+ size_t operator()(const std::unique_ptr<Entry>& m) const {
FXL_DCHECK(m);
return std::hash<std::string>{}(m->name_) ^
std::hash<DnsType>{}(m->type_);
@@ -98,7 +98,7 @@
struct Equals {
size_t operator()(const std::unique_ptr<Entry>& a,
- const std::unique_ptr<Entry>& b) {
+ const std::unique_ptr<Entry>& b) const {
FXL_DCHECK(a);
FXL_DCHECK(b);
return a->name_ == b->name_ && a->type_ == b->type_;
diff --git a/src/connectivity/network/testing/netemul/lib/network/network.cc b/src/connectivity/network/testing/netemul/lib/network/network.cc
index 0a86bb4..f717a1924 100644
--- a/src/connectivity/network/testing/netemul/lib/network/network.cc
+++ b/src/connectivity/network/testing/netemul/lib/network/network.cc
@@ -80,7 +80,7 @@
} else {
// if interceptors already have members, point onto the back for chaining
auto* next = interceptors_.back().get();
- return [this, next](InterceptPacket packet) {
+ return [next](InterceptPacket packet) {
next->Intercept(std::move(packet));
};
}
diff --git a/src/connectivity/network/testing/netemul/lib/sync/barrier_unittest.cc b/src/connectivity/network/testing/netemul/lib/sync/barrier_unittest.cc
index 92898ca..63e05f5 100644
--- a/src/connectivity/network/testing/netemul/lib/sync/barrier_unittest.cc
+++ b/src/connectivity/network/testing/netemul/lib/sync/barrier_unittest.cc
@@ -96,11 +96,10 @@
TEST_F(BarrierTest, DestroyWithPending) {
SyncManagerPtr sm;
GetSyncManager(sm.NewRequest());
- bool got_callback = false;
// wait and timeout:
sm->WaitForBarrierThreshold(
kMainTestBarrier, 2, zx::msec(0).to_nsecs(),
- [&got_callback](bool result) { FAIL() << "Shouldn't call callback"; });
+ [](bool result) { FAIL() << "Shouldn't call callback"; });
}
TEST_F(BarrierTest, ManyWaits) {
diff --git a/src/connectivity/network/testing/netemul/runner/helpers/netstack_intermediary/netstack_intermediary.cc b/src/connectivity/network/testing/netemul/runner/helpers/netstack_intermediary/netstack_intermediary.cc
index 36da938..e07b5eb 100644
--- a/src/connectivity/network/testing/netemul/runner/helpers/netstack_intermediary/netstack_intermediary.cc
+++ b/src/connectivity/network/testing/netemul/runner/helpers/netstack_intermediary/netstack_intermediary.cc
@@ -66,7 +66,7 @@
fake_ep_.events().OnData = [this](std::vector<uint8_t> data) {
eth_client_->Send(data.data(), data.size());
};
- fake_ep_.set_error_handler([this](zx_status_t status) {
+ fake_ep_.set_error_handler([](zx_status_t status) {
FXL_LOG(INFO) << "FakeEndpoint encountered error: "
<< zx_status_get_string(status);
});
@@ -104,7 +104,7 @@
(*netc)->GetNetworkManager(net_mgr->NewRequest());
(*net_mgr)->GetNetwork(
network_name,
- [this, completer = std::move(bridge.completer), network_name, netc,
+ [completer = std::move(bridge.completer), network_name, netc,
net_mgr](fidl::InterfaceHandle<fuchsia::netemul::network::Network>
net) mutable {
if (net.is_valid()) {
diff --git a/src/connectivity/network/testing/netemul/runner/sandbox.cc b/src/connectivity/network/testing/netemul/runner/sandbox.cc
index 35907c1..e02220d 100644
--- a/src/connectivity/network/testing/netemul/runner/sandbox.cc
+++ b/src/connectivity/network/testing/netemul/runner/sandbox.cc
@@ -451,7 +451,7 @@
ConfiguringEnvironmentPtr env, const config::Environment* config) {
ASSERT_HELPER_DISPATCHER;
auto launcher = std::make_shared<fuchsia::sys::LauncherSyncPtr>();
- return fit::make_promise([this, launcher, env]() -> PromiseResult {
+ return fit::make_promise([launcher, env]() -> PromiseResult {
// get launcher
if ((*env)->GetLauncher(launcher->NewRequest()) != ZX_OK) {
return fit::error(
diff --git a/src/connectivity/network/testing/netemul/runner/sandbox_unittest.cc b/src/connectivity/network/testing/netemul/runner/sandbox_unittest.cc
index b4c3e8a..0418b81b 100644
--- a/src/connectivity/network/testing/netemul/runner/sandbox_unittest.cc
+++ b/src/connectivity/network/testing/netemul/runner/sandbox_unittest.cc
@@ -601,7 +601,7 @@
// at the end of the check closure, it'll
// signal the root test with event code 100
// and finish the test.
- SetOnEvent([this, &check](EventType type) {
+ SetOnEvent([&check](EventType type) {
if (type != EventType::OnClientAttached) {
return;
}
diff --git a/src/connectivity/wlan/lib/mlme/cpp/include/wlan/mlme/mesh/deduplicator.h b/src/connectivity/wlan/lib/mlme/cpp/include/wlan/mlme/mesh/deduplicator.h
index 2f44351..418c418 100644
--- a/src/connectivity/wlan/lib/mlme/cpp/include/wlan/mlme/mesh/deduplicator.h
+++ b/src/connectivity/wlan/lib/mlme/cpp/include/wlan/mlme/mesh/deduplicator.h
@@ -32,7 +32,7 @@
// sequence number into an 8-byte hash by putting mac address
// in the top 6 bytes and the lower 2 bytes of sequence number
// in the last 2 bytes.
- inline std::size_t operator()(const MacAddrSeqPair& pkt) {
+ inline std::size_t operator()(const MacAddrSeqPair& pkt) const {
return pkt.first.ToU64() + pkt.second;
}
};
diff --git a/src/developer/feedback_agent/tests/data_provider_unittest.cc b/src/developer/feedback_agent/tests/data_provider_unittest.cc
index a22306b..c388dcb 100644
--- a/src/developer/feedback_agent/tests/data_provider_unittest.cc
+++ b/src/developer/feedback_agent/tests/data_provider_unittest.cc
@@ -321,7 +321,7 @@
feedback_responses.push_back({std::move(screenshot)});
});
}
- RunLoopUntil([&feedback_responses, num_calls] {
+ RunLoopUntil([&feedback_responses] {
return feedback_responses.size() == num_calls;
});
diff --git a/src/ledger/bin/p2p_sync/impl/ledger_communicator_impl.cc b/src/ledger/bin/p2p_sync/impl/ledger_communicator_impl.cc
index 6aecbef..b620a48 100644
--- a/src/ledger/bin/p2p_sync/impl/ledger_communicator_impl.cc
+++ b/src/ledger/bin/p2p_sync/impl/ledger_communicator_impl.cc
@@ -77,7 +77,7 @@
page_id, mesh_);
PageCommunicatorImpl* page_ptr = page.get();
pages_.emplace(page_id, page_ptr);
- page->set_on_delete([this, page_id = std::move(page_id), page_ptr] {
+ page->set_on_delete([this, page_id = std::move(page_id)] {
auto it = pages_.find(page_id);
FXL_DCHECK(it != pages_.end());
pages_.erase(it);
diff --git a/src/ledger/cloud_provider_firestore/bin/app/cloud_provider_impl_unittest.cc b/src/ledger/cloud_provider_firestore/bin/app/cloud_provider_impl_unittest.cc
index 376f4fa..a97aca7 100644
--- a/src/ledger/cloud_provider_firestore/bin/app/cloud_provider_impl_unittest.cc
+++ b/src/ledger/cloud_provider_firestore/bin/app/cloud_provider_impl_unittest.cc
@@ -47,7 +47,7 @@
TEST_F(CloudProviderImplTest, EmptyWhenClientDisconnected) {
bool on_empty_called = false;
cloud_provider_impl_->set_on_empty(
- [this, &on_empty_called] { on_empty_called = true; });
+ [&on_empty_called] { on_empty_called = true; });
EXPECT_FALSE(firestore_service_->shutdown_callback);
cloud_provider_.Unbind();
RunLoopUntilIdle();
@@ -64,7 +64,7 @@
TEST_F(CloudProviderImplTest, EmptyWhenFirebaseAuthDisconnected) {
bool on_empty_called = false;
cloud_provider_impl_->set_on_empty(
- [this, &on_empty_called] { on_empty_called = true; });
+ [&on_empty_called] { on_empty_called = true; });
firebase_auth_->TriggerConnectionErrorHandler();
RunLoopUntilIdle();
diff --git a/src/ledger/cloud_provider_firestore/bin/app/credentials_provider_impl.cc b/src/ledger/cloud_provider_firestore/bin/app/credentials_provider_impl.cc
index 6ff94af..cb8bc49 100644
--- a/src/ledger/cloud_provider_firestore/bin/app/credentials_provider_impl.cc
+++ b/src/ledger/cloud_provider_firestore/bin/app/credentials_provider_impl.cc
@@ -45,7 +45,7 @@
void CredentialsProviderImpl::GetCredentials(
fit::function<void(std::shared_ptr<grpc::CallCredentials>)> callback) {
auto request = firebase_auth_->GetFirebaseToken(
- [this, callback = std::move(callback)](
+ [callback = std::move(callback)](
firebase_auth::AuthStatus auth_status, std::string auth_token) {
switch (auth_status) {
case firebase_auth::AuthStatus::OK:
diff --git a/src/ledger/cloud_provider_memory_diff/validation/launch.cc b/src/ledger/cloud_provider_memory_diff/validation/launch.cc
index deac420..b59d7fe 100644
--- a/src/ledger/cloud_provider_memory_diff/validation/launch.cc
+++ b/src/ledger/cloud_provider_memory_diff/validation/launch.cc
@@ -29,8 +29,7 @@
component_context->svc()->Connect(component_launcher.NewRequest());
cloud_provider::ValidationTestsLauncher launcher(
component_context.get(),
- [component_launcher = std::move(component_launcher),
- &loop](auto request) {
+ [component_launcher = std::move(component_launcher)](auto request) {
fuchsia::sys::LaunchInfo launch_info;
launch_info.url = kCloudProviderUrl.ToString();
auto cloud_provider_services = sys::ServiceDirectory::CreateWithRequest(
diff --git a/src/ledger/lib/firebase_auth/testing/service_account_token_manager.cc b/src/ledger/lib/firebase_auth/testing/service_account_token_manager.cc
index 83fa274..0665525 100644
--- a/src/ledger/lib/firebase_auth/testing/service_account_token_manager.cc
+++ b/src/ledger/lib/firebase_auth/testing/service_account_token_manager.cc
@@ -65,7 +65,7 @@
GetFirebaseTokenCallback callback) {
service_account_token_minter_.GetFirebaseToken(
std::move(firebase_api_key),
- [this, callback = std::move(callback)](
+ [callback = std::move(callback)](
const ServiceAccountTokenMinter::GetTokenResponse& response) {
auto status = ConvertStatus(response.status);
diff --git a/src/media/audio/audio_core/test/audio_loopback_test.cc b/src/media/audio/audio_core/test/audio_loopback_test.cc
index 9e368a2..1336460 100644
--- a/src/media/audio/audio_core/test/audio_loopback_test.cc
+++ b/src/media/audio/audio_core/test/audio_loopback_test.cc
@@ -197,7 +197,7 @@
// Flush the audio
audio_renderer_[index]->DiscardAllPackets(
- [this, &flushed]() { flushed = true; });
+ [&flushed]() { flushed = true; });
EXPECT_TRUE(RunLoopWithTimeoutOrUntil(
[this, &flushed]() { return error_occurred_ || flushed; },
kDurationResponseExpected, kDurationGranularity))
@@ -306,7 +306,7 @@
// Get the minimum duration after submitting a packet to when we can start
// capturing what we sent on the loopback interface
zx_duration_t sleep_duration = 0;
- audio_renderer_[0]->GetMinLeadTime([this, &sleep_duration](zx_duration_t t) {
+ audio_renderer_[0]->GetMinLeadTime([&sleep_duration](zx_duration_t t) {
// Give a little wiggle room.
sleep_duration = t + ZX_MSEC(5);
});
@@ -330,7 +330,7 @@
// we should have mixed audio available for capture. Our playback is sized
// to be much much larger than our capture to prevent test flakes.
audio_renderer_[0]->Play(zx_clock_get_monotonic(), 0,
- [this, &ref_time_received, &media_time_received](
+ [&ref_time_received, &media_time_received](
int64_t ref_time, int64_t media_time) {
ref_time_received = ref_time;
media_time_received = media_time;
@@ -407,7 +407,7 @@
// true for this test as we create the renderers with the same parameters, but
// is not a safe assumption for the general users of this API to make.
zx_duration_t sleep_duration = 0;
- audio_renderer_[0]->GetMinLeadTime([this, &sleep_duration](zx_duration_t t) {
+ audio_renderer_[0]->GetMinLeadTime([&sleep_duration](zx_duration_t t) {
// Give a little wiggle room.
sleep_duration = t + ZX_MSEC(5);
});
@@ -435,7 +435,7 @@
audio_renderer_[0]->PlayNoReply(playat, 0);
// Only get the callback for the second renderer.
audio_renderer_[1]->Play(playat, 0,
- [this, &ref_time_received, &media_time_received](
+ [&ref_time_received, &media_time_received](
int64_t ref_time, int64_t media_time) {
ref_time_received = ref_time;
media_time_received = media_time;
diff --git a/src/media/audio/audio_core/test/audio_renderer_test.cc b/src/media/audio/audio_core/test/audio_renderer_test.cc
index 2a3fee7..fe6ed27 100644
--- a/src/media/audio/audio_core/test/audio_renderer_test.cc
+++ b/src/media/audio/audio_core/test/audio_renderer_test.cc
@@ -330,7 +330,7 @@
audio_renderer_->Play(fuchsia::media::NO_TIMESTAMP,
fuchsia::media::NO_TIMESTAMP,
- [this, &ref_time_received, &media_time_received](
+ [&ref_time_received, &media_time_received](
int64_t ref_time, int64_t media_time) {
ref_time_received = ref_time;
media_time_received = media_time;
@@ -357,7 +357,7 @@
audio_renderer_->Play(fuchsia::media::NO_TIMESTAMP,
fuchsia::media::NO_TIMESTAMP,
- [this, &ref_time_received, &media_time_received](
+ [&ref_time_received, &media_time_received](
int64_t ref_time, int64_t media_time) {
ref_time_received = ref_time;
media_time_received = media_time;
@@ -387,7 +387,7 @@
int64_t ref_time_received = -1;
int64_t media_time_received = -1;
- audio_renderer_->Pause([this, &ref_time_received, &media_time_received](
+ audio_renderer_->Pause([&ref_time_received, &media_time_received](
int64_t ref_time, int64_t media_time) {
ref_time_received = ref_time;
media_time_received = media_time;
@@ -412,7 +412,7 @@
int64_t ref_time_received = -1;
int64_t media_time_received = -1;
- audio_renderer_->Pause([this, &ref_time_received, &media_time_received](
+ audio_renderer_->Pause([&ref_time_received, &media_time_received](
int64_t ref_time, int64_t media_time) {
ref_time_received = ref_time;
media_time_received = media_time;
diff --git a/src/media/playback/mediaplayer/fidl/fidl_decoder.cc b/src/media/playback/mediaplayer/fidl/fidl_decoder.cc
index 2039651..0f29ab4 100644
--- a/src/media/playback/mediaplayer/fidl/fidl_decoder.cc
+++ b/src/media/playback/mediaplayer/fidl/fidl_decoder.cc
@@ -319,7 +319,7 @@
physically_contiguous_required
? std::move(*constraints->mutable_very_temp_kludge_bti_handle())
: zx::handle(),
- [this, ¤t_set](uint64_t size, const PayloadVmos& payload_vmos) {
+ [¤t_set](uint64_t size, const PayloadVmos& payload_vmos) {
// This callback runs on an arbitrary thread.
return current_set.AllocateBuffer(size, payload_vmos);
});