From c636408a7a856ef4364f4a8bba0236573d16e69e Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 20 Mar 2019 21:13:45 +0300 Subject: [PATCH] Remove unneded mutable specifiers. GitOrigin-RevId: 528550993874adb2ff29f9f88273339937919c8b --- td/telegram/CallManager.cpp | 2 +- td/telegram/ContactsManager.cpp | 2 +- td/telegram/FileReferenceManager.cpp | 27 +++++++-------- td/telegram/LanguagePackManager.cpp | 4 +-- td/telegram/MessagesManager.cpp | 52 +++++++++++++--------------- td/telegram/PrivacyManager.cpp | 2 +- td/telegram/Td.cpp | 4 +-- 7 files changed, 45 insertions(+), 48 deletions(-) diff --git a/td/telegram/CallManager.cpp b/td/telegram/CallManager.cpp index 4801a9c44..03d8beb4a 100644 --- a/td/telegram/CallManager.cpp +++ b/td/telegram/CallManager.cpp @@ -95,7 +95,7 @@ CallId CallManager::create_call_actor() { auto it_flag = id_to_actor_.emplace(id, ActorOwn()); CHECK(it_flag.second); LOG(INFO) << "Create CallActor: " << id; - auto main_promise = PromiseCreator::lambda([actor_id = actor_id(this), id](Result call_id) mutable { + auto main_promise = PromiseCreator::lambda([actor_id = actor_id(this), id](Result call_id) { send_closure(actor_id, &CallManager::set_call_id, id, std::move(call_id)); }); it_flag.first->second = create_actor(PSLICE() << "Call " << id.get(), id, actor_shared(this, id.get()), diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index b260f1765..7b6a34330 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -9117,7 +9117,7 @@ bool ContactsManager::get_chat_full(ChatId chat_id, Promise &&promise) { } void ContactsManager::send_get_chat_full_query(ChatId chat_id, Promise &&promise) { - auto send_query = PromiseCreator::lambda([td = td_, chat_id](Result> &&promise) mutable { + auto send_query = PromiseCreator::lambda([td = td_, chat_id](Result> &&promise) { if (promise.is_ok()) { td->create_handler(promise.move_as_ok())->send(chat_id); } diff --git a/td/telegram/FileReferenceManager.cpp b/td/telegram/FileReferenceManager.cpp index c183b954d..7c00b1cfc 100644 --- a/td/telegram/FileReferenceManager.cpp +++ b/td/telegram/FileReferenceManager.cpp @@ -211,26 +211,25 @@ void FileReferenceManager::send_query(Destination dest, FileSourceId file_source node.query->active_queries++; auto promise = PromiseCreator::lambda([dest, file_source_id, file_reference_manager = G()->file_reference_manager(), - file_manager = G()->file_manager()](Result result) mutable { + file_manager = G()->file_manager()](Result result) { if (G()->close_flag()) { VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing"; return; } - auto new_promise = - PromiseCreator::lambda([dest, file_source_id, file_reference_manager](Result result) mutable { - if (G()->close_flag()) { - VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing"; - return; - } + auto new_promise = PromiseCreator::lambda([dest, file_source_id, file_reference_manager](Result result) { + if (G()->close_flag()) { + VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing"; + return; + } - Status status; - if (result.is_error()) { - status = result.move_as_error(); - } - send_closure(file_reference_manager, &FileReferenceManager::on_query_result, dest, file_source_id, - std::move(status), 0); - }); + Status status; + if (result.is_error()) { + status = result.move_as_error(); + } + send_closure(file_reference_manager, &FileReferenceManager::on_query_result, dest, file_source_id, + std::move(status), 0); + }); send_lambda(file_manager, [file_manager, dest, result = std::move(result), file_source_id, new_promise = std::move(new_promise)]() mutable { diff --git a/td/telegram/LanguagePackManager.cpp b/td/telegram/LanguagePackManager.cpp index d825b683d..19d01ff45 100644 --- a/td/telegram/LanguagePackManager.cpp +++ b/td/telegram/LanguagePackManager.cpp @@ -990,8 +990,8 @@ void LanguagePackManager::get_language_pack_strings(string language_code, vector auto result_promise = PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_, language_code]( Result> r_strings) mutable { - send_closure(actor_id, &LanguagePackManager::on_get_all_language_pack_strings, language_pack, language_code, - std::move(r_strings)); + send_closure(actor_id, &LanguagePackManager::on_get_all_language_pack_strings, std::move(language_pack), + std::move(language_code), std::move(r_strings)); }); auto request_promise = PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_, language_code, diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index afd1ecbb7..1f222bc93 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6344,7 +6344,7 @@ void MessagesManager::load_secret_thumbnail(FileId thumbnail_file_id) { }; auto thumbnail_promise = PromiseCreator::lambda([actor_id = actor_id(this), - thumbnail_file_id](Result r_thumbnail) mutable { + thumbnail_file_id](Result r_thumbnail) { BufferSlice thumbnail_slice; if (r_thumbnail.is_ok()) { thumbnail_slice = r_thumbnail.move_as_ok(); @@ -12443,13 +12443,12 @@ void MessagesManager::save_dialog_draft_message_on_server(DialogId dialog_id) { Promise<> promise; if (d->save_draft_message_logevent_id != 0) { - promise = PromiseCreator::lambda( - [actor_id = actor_id(this), dialog_id, - generation = d->save_draft_message_logevent_id_generation](Result result) mutable { - if (!G()->close_flag()) { - send_closure(actor_id, &MessagesManager::on_saved_dialog_draft_message, dialog_id, generation); - } - }); + promise = PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, + generation = d->save_draft_message_logevent_id_generation](Result result) { + if (!G()->close_flag()) { + send_closure(actor_id, &MessagesManager::on_saved_dialog_draft_message, dialog_id, generation); + } + }); } // TODO do not send two queries simultaneously or use SequenceDispatcher @@ -12807,7 +12806,7 @@ void MessagesManager::update_dialog_notification_settings_on_server(DialogId dia if (d->save_notification_settings_logevent_id != 0) { promise = PromiseCreator::lambda( [actor_id = actor_id(this), dialog_id, - generation = d->save_notification_settings_logevent_id_generation](Result result) mutable { + generation = d->save_notification_settings_logevent_id_generation](Result result) { if (!G()->close_flag()) { send_closure(actor_id, &MessagesManager::on_updated_dialog_notification_settings, dialog_id, generation); } @@ -13960,13 +13959,12 @@ void MessagesManager::read_history_on_server_impl(DialogId dialog_id, MessageId Promise<> promise; if (d->read_history_logevent_id != 0) { - promise = - PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, - generation = d->read_history_logevent_id_generation](Result result) mutable { - if (!G()->close_flag()) { - send_closure(actor_id, &MessagesManager::on_read_history_finished, dialog_id, generation); - } - }); + promise = PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, + generation = d->read_history_logevent_id_generation](Result result) { + if (!G()->close_flag()) { + send_closure(actor_id, &MessagesManager::on_read_history_finished, dialog_id, generation); + } + }); } LOG(INFO) << "Send read history request in " << dialog_id << " up to " << max_message_id; @@ -16340,18 +16338,18 @@ void MessagesManager::on_upload_message_media_finished(int64 media_album_id, Dia // send later, because some messages may be being deleted now for (auto request_message_id : request.message_ids) { LOG(INFO) << "Send on_media_message_ready_to_send for " << request_message_id << " in " << dialog_id; - send_closure_later( - actor_id(this), &MessagesManager::on_media_message_ready_to_send, dialog_id, request_message_id, - PromiseCreator::lambda([actor_id = actor_id(this), media_album_id](Result result) mutable { - if (result.is_error() || G()->close_flag()) { - return; - } + send_closure_later(actor_id(this), &MessagesManager::on_media_message_ready_to_send, dialog_id, + request_message_id, + PromiseCreator::lambda([actor_id = actor_id(this), media_album_id](Result result) { + if (result.is_error() || G()->close_flag()) { + return; + } - auto m = result.move_as_ok(); - CHECK(m != nullptr); - CHECK(m->media_album_id == media_album_id); - send_closure_later(actor_id, &MessagesManager::do_send_message_group, media_album_id); - })); + auto m = result.move_as_ok(); + CHECK(m != nullptr); + CHECK(m->media_album_id == media_album_id); + send_closure_later(actor_id, &MessagesManager::do_send_message_group, media_album_id); + })); } } } diff --git a/td/telegram/PrivacyManager.cpp b/td/telegram/PrivacyManager.cpp index 341c86526..f344082cf 100644 --- a/td/telegram/PrivacyManager.cpp +++ b/td/telegram/PrivacyManager.cpp @@ -279,7 +279,7 @@ void PrivacyManager::get_privacy(tl_object_ptr key, create_storer(telegram_api::account_getPrivacy(user_privacy_setting.as_telegram_api()))); send_with_promise(std::move(net_query), - PromiseCreator::lambda([this, user_privacy_setting](Result x_net_query) mutable { + PromiseCreator::lambda([this, user_privacy_setting](Result x_net_query) { on_get_result(user_privacy_setting, [&]() -> Result { TRY_RESULT(net_query, std::move(x_net_query)); TRY_RESULT(rules, fetch_result(std::move(net_query))); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 7e1bedd4f..4b91fa994 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4429,7 +4429,7 @@ void Td::answer_ok_query(uint64 id, Status status) { } Promise Td::create_ok_request_promise(uint64 id) { - return PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result result) mutable { + return PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result result) { if (result.is_error()) { send_closure(actor_id, &Td::send_error, id, result.move_as_error()); } else { @@ -7012,7 +7012,7 @@ void Td::on_request(uint64 id, td_api::removeRecentHashtag &request) { void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.terms_of_service_id_); - auto promise = PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<> result) mutable { + auto promise = PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<> result) { if (result.is_error()) { send_closure(actor_id, &Td::send_error, id, result.move_as_error()); } else {