Skip to content

Commit 338e4e5

Browse files
committed
Remove more unused context captures.
1 parent 8bea6ac commit 338e4e5

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎tde2e/td/e2e/Blockchain.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Block Block::from_tl(const e2e::e2e_chain_block &block) {
185185
}
186186
result.signature_ = Signature::from_u512(block.signature_);
187187
result.prev_block_hash_ = block.prev_block_hash_;
188-
auto change_from_tl = [&](auto &obj) {
188+
auto change_from_tl = [](auto &obj) {
189189
return Change::from_tl(*obj);
190190
};
191191
result.changes_ = td::transform(block.changes_, change_from_tl);

‎tde2e/td/e2e/EncryptedStorage.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ td::Result<EncryptedStorage::KeyValueUpdates> EncryptedStorage::apply_block(td::
225225
for (auto &change : changes) {
226226
bool skip = false;
227227
td::Result<std::pair<Key, std::optional<Value>>> r_p;
228-
std::visit(td::overloaded([&](ChangeNoop &noop) {},
228+
std::visit(td::overloaded([](ChangeNoop &noop) {},
229229
[&](ChangeSetValue &set_value) { r_p = parse(set_value.key, set_value.value); },
230230
[&](ChangeSetGroupState &) { skip = true; }, [&](ChangeSetSharedKey &) { skip = true; }),
231231
change.value);

‎tde2e/td/e2e/e2e_api.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class KeyChain {
6868

6969
td::Result<api::PrivateKeyId> generate_dummy_key() {
7070
auto hash = to_hash("dummy key", "...");
71-
return container_.try_build<Key>(hash, [&]() -> td::Result<PrivateKeyWithMnemonic> {
71+
return container_.try_build<Key>(hash, []() -> td::Result<PrivateKeyWithMnemonic> {
7272
td::SecureString key(32, 1);
7373
return PrivateKeyWithMnemonic::from_private_key(PrivateKey::from_slice(key).move_as_ok(), {});
7474
});
@@ -295,7 +295,7 @@ class KeyChain {
295295

296296
td::Result<api::SymmetricKeyId> handshake_get_shared_key_id(api::HandshakeId handshake_id) {
297297
TRY_RESULT(handshake, container_.get_unique<Handshake>(handshake_id));
298-
TRY_RESULT(shared_secret, std::visit([&](auto &&v) { return v.shared_secret(); }, *handshake));
298+
TRY_RESULT(shared_secret, std::visit([](auto &&v) { return v.shared_secret(); }, *handshake));
299299
auto hash = to_hash("handshake shared_secret", shared_secret.as_slice());
300300
return container_.try_build<Key>(hash, [&]() -> td::Result<td::SecureString> { return std::move(shared_secret); });
301301
}
@@ -559,8 +559,8 @@ class KeyChain {
559559
td::Result<PublicKey> to_public_key(api::AnyKeyId key_id) const {
560560
TRY_RESULT(key, container_.get_shared<Key>(key_id));
561561
return std::visit(
562-
td::overloaded([&](const PrivateKeyWithMnemonic &pk) -> td::Result<PublicKey> { return pk.to_public_key(); },
563-
[&](const PublicKey &pk) -> td::Result<PublicKey> { return pk; },
562+
td::overloaded([](const PrivateKeyWithMnemonic &pk) -> td::Result<PublicKey> { return pk.to_public_key(); },
563+
[](const PublicKey &pk) -> td::Result<PublicKey> { return pk; },
564564
[](const auto &) -> td::Result<PublicKey> {
565565
return td::Status::Error(static_cast<int>(api::ErrorCode::InvalidInput),
566566
"key_id doesn't contain public key");

‎tde2e/test/e2e.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ struct BaselineBlockchainState {
590590
}
591591
void apply_changes(const std::vector<Change> &changes) {
592592
for (const auto &change_v : changes) {
593-
std::visit(td::overloaded([&](const ChangeNoop &) {},
593+
std::visit(td::overloaded([](const ChangeNoop &) {},
594594
[&](const ChangeSetValue &change) { key_value_state[change.key] = change.value; },
595595
[&](const ChangeSetGroupState &change) { group_state = change.group_state; },
596596
[&](const ChangeSetSharedKey &change) { shared_key = change.shared_key; }),

‎tdutils/td/utils/port/FileFd.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Result<FileFd> FileFd::open(CSlice filepath, int32 flags, int32 mode) {
168168
if (native_fd < MINIMUM_FILE_DESCRIPTOR) {
169169
::close(native_fd);
170170
LOG(ERROR) << "Receive " << native_fd << " as a file descriptor";
171-
int dummy_fd = detail::skip_eintr([&] { return ::open("/dev/null", O_RDONLY, 0); });
171+
int dummy_fd = detail::skip_eintr([] { return ::open("/dev/null", O_RDONLY, 0); });
172172
if (dummy_fd < 0) {
173173
return OS_ERROR("Can't open /dev/null");
174174
}

‎tdutils/td/utils/port/SocketFd.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ Result<SocketFd> SocketFd::open(const IPAddress &address) {
643643
while (native_fd.socket() < MINIMUM_FILE_DESCRIPTOR) {
644644
native_fd.close();
645645
LOG(ERROR) << "Receive " << native_fd << " as a file descriptor";
646-
int dummy_fd = detail::skip_eintr([&] { return ::open("/dev/null", O_RDONLY, 0); });
646+
int dummy_fd = detail::skip_eintr([] { return ::open("/dev/null", O_RDONLY, 0); });
647647
if (dummy_fd < 0) {
648648
return OS_ERROR("Can't open /dev/null");
649649
}

0 commit comments

Comments
 (0)