Remove unneeded brackets.

GitOrigin-RevId: 0b8a2ae21d28e6c276db8b45ffb4d127800f5d73
This commit is contained in:
levlam 2020-02-26 18:15:19 +03:00
parent c3f802f55f
commit 92df8f9827
19 changed files with 33 additions and 34 deletions

View File

@ -791,7 +791,7 @@ class ConfigRecoverer : public Actor {
PromiseCreator::lambda([actor_id = actor_shared(this)](Result<SimpleConfigResult> r_simple_config) {
send_closure(actor_id, &ConfigRecoverer::on_simple_config, std::move(r_simple_config), false);
});
auto get_simple_config = [&]() {
auto get_simple_config = [&] {
switch (simple_config_turn_ % 4) {
case 2:
return get_simple_config_azure;

View File

@ -12426,7 +12426,7 @@ void ContactsManager::on_chat_update(telegram_api::chat &chat, const char *sourc
return;
}
DialogParticipantStatus status = [&]() {
DialogParticipantStatus status = [&] {
bool is_creator = 0 != (chat.flags_ & CHAT_FLAG_USER_IS_CREATOR);
bool has_left = 0 != (chat.flags_ & CHAT_FLAG_USER_HAS_LEFT);
bool was_kicked = 0 != (chat.flags_ & CHAT_FLAG_USER_WAS_KICKED);
@ -12590,7 +12590,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
is_slow_mode_enabled = false;
}
DialogParticipantStatus status = [&]() {
DialogParticipantStatus status = [&] {
bool has_left = (channel.flags_ & CHANNEL_FLAG_USER_HAS_LEFT) != 0;
bool is_creator = (channel.flags_ & CHANNEL_FLAG_USER_IS_CREATOR) != 0;

View File

@ -38,19 +38,19 @@ Status init_dialog_db(SqliteDb &db, int32 version, bool &was_created) {
version = 0;
}
auto create_notification_group_table = [&db]() {
auto create_notification_group_table = [&db] {
return db.exec(
"CREATE TABLE IF NOT EXISTS notification_groups (notification_group_id INT4 PRIMARY KEY, dialog_id "
"INT8, last_notification_date INT4)");
};
auto create_last_notification_date_index = [&db]() {
auto create_last_notification_date_index = [&db] {
return db.exec(
"CREATE INDEX IF NOT EXISTS notification_group_by_last_notification_date ON notification_groups "
"(last_notification_date, dialog_id, notification_group_id) WHERE last_notification_date IS NOT NULL");
};
auto add_dialogs_in_folder_index = [&db]() {
auto add_dialogs_in_folder_index = [&db] {
return db.exec(
"CREATE INDEX IF NOT EXISTS dialog_in_folder_by_dialog_order ON dialogs (folder_id, dialog_order, dialog_id) "
"WHERE folder_id IS NOT NULL");

View File

@ -4476,7 +4476,7 @@ void update_message_content_file_id_remote(MessageContent *content, FileId file_
if (file_id.get_remote() == 0) {
return;
}
FileId *old_file_id = [&]() {
FileId *old_file_id = [&] {
switch (content->get_type()) {
case MessageContentType::Animation:
return &static_cast<MessageAnimation *>(content)->file_id;

View File

@ -85,7 +85,7 @@ Status init_messages_db(SqliteDb &db, int32 version) {
return Status::OK();
};
auto add_call_index = [&db]() {
auto add_call_index = [&db] {
for (int i = static_cast<int>(SearchMessagesFilter::Call) - 1;
i < static_cast<int>(SearchMessagesFilter::MissedCall); i++) {
TRY_STATUS(db.exec(PSLICE() << "CREATE INDEX IF NOT EXISTS full_message_index_" << i
@ -93,12 +93,12 @@ Status init_messages_db(SqliteDb &db, int32 version) {
}
return Status::OK();
};
auto add_notification_id_index = [&db]() {
auto add_notification_id_index = [&db] {
return db.exec(
"CREATE INDEX IF NOT EXISTS message_by_notification_id ON messages (dialog_id, notification_id) WHERE "
"notification_id IS NOT NULL");
};
auto add_scheduled_messages_table = [&db]() {
auto add_scheduled_messages_table = [&db] {
TRY_STATUS(
db.exec("CREATE TABLE IF NOT EXISTS scheduled_messages (dialog_id INT8, message_id INT8, "
"server_message_id INT4, data BLOB, PRIMARY KEY (dialog_id, message_id))"));

View File

@ -818,7 +818,7 @@ int32 NotificationManager::get_notification_delay_ms(DialogId dialog_id, const P
return MIN_NOTIFICATION_DELAY_MS;
}
auto delay_ms = [&]() {
auto delay_ms = [&] {
auto online_info = td_->contacts_manager_->get_my_online_status();
if (!online_info.is_online_local && online_info.is_online_remote) {
// If we are offline, but online from some other client, then delay notification

View File

@ -225,7 +225,7 @@ Secret Secret::clone() const {
}
EncryptedSecret Secret::encrypt(Slice key, Slice salt, EnryptionAlgorithm algorithm) {
auto aes_cbc_state = [&]() {
auto aes_cbc_state = [&] {
switch (algorithm) {
case EnryptionAlgorithm::Sha512:
return calc_aes_cbc_state_sha512(PSLICE() << salt << key << salt);
@ -255,7 +255,7 @@ Result<EncryptedSecret> EncryptedSecret::create(Slice encrypted_secret) {
}
Result<Secret> EncryptedSecret::decrypt(Slice key, Slice salt, EnryptionAlgorithm algorithm) {
auto aes_cbc_state = [&]() {
auto aes_cbc_state = [&] {
switch (algorithm) {
case EnryptionAlgorithm::Sha512:
return calc_aes_cbc_state_sha512(PSLICE() << salt << key << salt);

View File

@ -3596,7 +3596,7 @@ tl_object_ptr<telegram_api::inputStickerSetItem> StickersManager::get_input_stic
tl_object_ptr<telegram_api::maskCoords> mask_coords;
if (sticker->mask_position_ != nullptr && sticker->mask_position_->point_ != nullptr) {
auto point = [mask_point = std::move(sticker->mask_position_->point_)]() {
auto point = [mask_point = std::move(sticker->mask_position_->point_)] {
switch (mask_point->get_id()) {
case td_api::maskPointForehead::ID:
return 0;

View File

@ -171,7 +171,7 @@ void SessionProxy::open_session(bool force) {
// 1. All unauthorized query will be sent into the same SessionProxy
// 2. All authorized query are delayed before we have authorization
// So only one SessionProxy will be active before we have authorization key
auto should_open = [&]() {
auto should_open = [&] {
if (force) {
return true;
}

View File

@ -78,7 +78,7 @@ void ConcurrentScheduler::start() {
#if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED
for (size_t i = 1; i + extra_scheduler_ < schedulers_.size(); i++) {
auto &sched = schedulers_[i];
threads_.push_back(td::thread([&]() {
threads_.push_back(td::thread([&] {
#if TD_PORT_WINDOWS
detail::Iocp::Guard iocp_guard(iocp_.get());
#endif

View File

@ -244,7 +244,7 @@ void Scheduler::clear() {
if (callback_) {
// can't move lambda with unique_ptr inside into std::function
auto ptr = actor_info_pool_.release();
callback_->register_at_finish([=]() { delete ptr; });
callback_->register_at_finish([ptr] { delete ptr; });
} else {
actor_info_pool_.reset();
}

View File

@ -235,7 +235,7 @@ void Scheduler::send_lambda(ActorRef actor_ref, EventT &&lambda) {
event_context_ptr_->link_token = actor_ref.token();
lambda();
},
[&]() {
[&] {
auto event = Event::lambda(std::forward<EventT>(lambda));
event.set_link_token(actor_ref.token());
return event;
@ -250,7 +250,7 @@ void Scheduler::send_closure(ActorRef actor_ref, EventT &&closure) {
event_context_ptr_->link_token = actor_ref.token();
closure.run(static_cast<typename EventT::ActorType *>(actor_info->get_actor_unsafe()));
},
[&]() {
[&] {
auto event = Event::immediate_closure(std::forward<EventT>(closure));
event.set_link_token(actor_ref.token());
return event;
@ -262,7 +262,7 @@ void Scheduler::send(ActorRef actor_ref, Event &&event) {
event.set_link_token(actor_ref.token());
return send_impl<send_type>(
actor_ref.get(), [&](ActorInfo *actor_info) { do_event(actor_info, std::move(event)); },
[&]() { return std::move(event); });
[&] { return std::move(event); });
}
inline void Scheduler::subscribe(PollableFd fd, PollFlags flags) {

View File

@ -24,7 +24,7 @@ Result<bool> SqliteKeyValue::init(string path) {
}
Status SqliteKeyValue::init_with_connection(SqliteDb connection, string table_name) {
auto init_guard = ScopeExit() + [&]() {
auto init_guard = ScopeExit() + [&] {
close();
};
db_ = std::move(connection);

View File

@ -224,7 +224,7 @@ class SslStreamImpl {
if (ssl_ctx == nullptr) {
return create_openssl_error(-7, "Failed to create an SSL context");
}
auto ssl_ctx_guard = ScopeExit() + [&]() {
auto ssl_ctx_guard = ScopeExit() + [&] {
SSL_CTX_free(ssl_ctx);
};
long options = 0;
@ -313,7 +313,7 @@ class SslStreamImpl {
if (ssl_handle == nullptr) {
return create_openssl_error(-13, "Failed to create an SSL handle");
}
auto ssl_handle_guard = ScopeExit() + [&]() {
auto ssl_handle_guard = ScopeExit() + [&] {
do_ssl_shutdown(ssl_handle);
SSL_free(ssl_handle);
};

View File

@ -135,7 +135,7 @@ int Random::fast(int min, int max) {
}
Random::Xorshift128plus::Xorshift128plus(uint64 seed) {
auto next = [&]() {
auto next = [&] {
// splitmix64
seed += static_cast<uint64>(0x9E3779B97F4A7C15);
uint64 z = seed;

View File

@ -74,4 +74,4 @@ auto operator+(ScopeExit, FunctionT &&func) {
} // namespace td
#define SCOPE_EXIT auto TD_CONCAT(SCOPE_EXIT_VAR_, __LINE__) = ::td::ScopeExit() + [&]()
#define SCOPE_EXIT auto TD_CONCAT(SCOPE_EXIT_VAR_, __LINE__) = ::td::ScopeExit() + [&]

View File

@ -75,19 +75,19 @@
#if TD_PORT_POSIX
#define OS_ERROR(message) \
[&]() { \
[&] { \
auto saved_errno = errno; \
return ::td::Status::PosixError(saved_errno, (message)); \
}()
#define OS_SOCKET_ERROR(message) OS_ERROR(message)
#elif TD_PORT_WINDOWS
#define OS_ERROR(message) \
[&]() { \
[&] { \
auto saved_error = ::GetLastError(); \
return ::td::Status::WindowsError(saved_error, (message)); \
}()
#define OS_SOCKET_ERROR(message) \
[&]() { \
[&] { \
auto saved_error = ::WSAGetLastError(); \
return ::td::Status::WindowsError(saved_error, (message)); \
}()

View File

@ -831,8 +831,7 @@ TEST(Misc, Bits) {
uint8 buf[8] = {1, 90, 2, 18, 129, 255, 0, 2};
uint64 num2 = bswap64(as<td::uint64>(buf));
uint64 num =
(static_cast<uint64>(buf[0]) << 56) | (static_cast<uint64>(buf[1]) << 48) |
uint64 num = (static_cast<uint64>(buf[0]) << 56) | (static_cast<uint64>(buf[1]) << 48) |
(static_cast<uint64>(buf[2]) << 40) | (static_cast<uint64>(buf[3]) << 32) |
(static_cast<uint64>(buf[4]) << 24) | (static_cast<uint64>(buf[5]) << 16) |
(static_cast<uint64>(buf[6]) << 8) | (static_cast<uint64>(buf[7]));

View File

@ -377,7 +377,7 @@ TEST(DB, thread_key_value) {
std::vector<thread> threads(threads_n);
std::vector<std::vector<DbQuery>> res(threads_n);
for (int i = 0; i < threads_n; i++) {
threads[i] = thread([&ts_kv, &queries, &res, i]() {
threads[i] = thread([&ts_kv, &queries, &res, i] {
for (auto q : queries[i]) {
ts_kv.do_query(q);
res[i].push_back(q);