Remove unneded mutable specifiers.

GitOrigin-RevId: 528550993874adb2ff29f9f88273339937919c8b
This commit is contained in:
levlam 2019-03-20 21:13:45 +03:00
parent 9b8a5438be
commit c636408a7a
7 changed files with 45 additions and 48 deletions

View File

@ -95,7 +95,7 @@ CallId CallManager::create_call_actor() {
auto it_flag = id_to_actor_.emplace(id, ActorOwn<CallActor>()); auto it_flag = id_to_actor_.emplace(id, ActorOwn<CallActor>());
CHECK(it_flag.second); CHECK(it_flag.second);
LOG(INFO) << "Create CallActor: " << id; LOG(INFO) << "Create CallActor: " << id;
auto main_promise = PromiseCreator::lambda([actor_id = actor_id(this), id](Result<int64> call_id) mutable { auto main_promise = PromiseCreator::lambda([actor_id = actor_id(this), id](Result<int64> call_id) {
send_closure(actor_id, &CallManager::set_call_id, id, std::move(call_id)); send_closure(actor_id, &CallManager::set_call_id, id, std::move(call_id));
}); });
it_flag.first->second = create_actor<CallActor>(PSLICE() << "Call " << id.get(), id, actor_shared(this, id.get()), it_flag.first->second = create_actor<CallActor>(PSLICE() << "Call " << id.get(), id, actor_shared(this, id.get()),

View File

@ -9117,7 +9117,7 @@ bool ContactsManager::get_chat_full(ChatId chat_id, Promise<Unit> &&promise) {
} }
void ContactsManager::send_get_chat_full_query(ChatId chat_id, Promise<Unit> &&promise) { void ContactsManager::send_get_chat_full_query(ChatId chat_id, Promise<Unit> &&promise) {
auto send_query = PromiseCreator::lambda([td = td_, chat_id](Result<Promise<Unit>> &&promise) mutable { auto send_query = PromiseCreator::lambda([td = td_, chat_id](Result<Promise<Unit>> &&promise) {
if (promise.is_ok()) { if (promise.is_ok()) {
td->create_handler<GetFullChatQuery>(promise.move_as_ok())->send(chat_id); td->create_handler<GetFullChatQuery>(promise.move_as_ok())->send(chat_id);
} }

View File

@ -211,14 +211,13 @@ void FileReferenceManager::send_query(Destination dest, FileSourceId file_source
node.query->active_queries++; node.query->active_queries++;
auto promise = PromiseCreator::lambda([dest, file_source_id, file_reference_manager = G()->file_reference_manager(), auto promise = PromiseCreator::lambda([dest, file_source_id, file_reference_manager = G()->file_reference_manager(),
file_manager = G()->file_manager()](Result<Unit> result) mutable { file_manager = G()->file_manager()](Result<Unit> result) {
if (G()->close_flag()) { if (G()->close_flag()) {
VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing"; VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing";
return; return;
} }
auto new_promise = auto new_promise = PromiseCreator::lambda([dest, file_source_id, file_reference_manager](Result<Unit> result) {
PromiseCreator::lambda([dest, file_source_id, file_reference_manager](Result<Unit> result) mutable {
if (G()->close_flag()) { if (G()->close_flag()) {
VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing"; VLOG(file_references) << "Ignore file reference repair from " << file_source_id << " during closing";
return; return;

View File

@ -990,8 +990,8 @@ void LanguagePackManager::get_language_pack_strings(string language_code, vector
auto result_promise = auto result_promise =
PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_, language_code]( PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_, language_code](
Result<td_api::object_ptr<td_api::languagePackStrings>> r_strings) mutable { Result<td_api::object_ptr<td_api::languagePackStrings>> r_strings) mutable {
send_closure(actor_id, &LanguagePackManager::on_get_all_language_pack_strings, language_pack, language_code, send_closure(actor_id, &LanguagePackManager::on_get_all_language_pack_strings, std::move(language_pack),
std::move(r_strings)); std::move(language_code), std::move(r_strings));
}); });
auto request_promise = auto request_promise =
PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_, language_code, PromiseCreator::lambda([actor_id = actor_id(this), language_pack = language_pack_, language_code,

View File

@ -6344,7 +6344,7 @@ void MessagesManager::load_secret_thumbnail(FileId thumbnail_file_id) {
}; };
auto thumbnail_promise = PromiseCreator::lambda([actor_id = actor_id(this), auto thumbnail_promise = PromiseCreator::lambda([actor_id = actor_id(this),
thumbnail_file_id](Result<BufferSlice> r_thumbnail) mutable { thumbnail_file_id](Result<BufferSlice> r_thumbnail) {
BufferSlice thumbnail_slice; BufferSlice thumbnail_slice;
if (r_thumbnail.is_ok()) { if (r_thumbnail.is_ok()) {
thumbnail_slice = r_thumbnail.move_as_ok(); thumbnail_slice = r_thumbnail.move_as_ok();
@ -12443,9 +12443,8 @@ void MessagesManager::save_dialog_draft_message_on_server(DialogId dialog_id) {
Promise<> promise; Promise<> promise;
if (d->save_draft_message_logevent_id != 0) { if (d->save_draft_message_logevent_id != 0) {
promise = PromiseCreator::lambda( promise = PromiseCreator::lambda([actor_id = actor_id(this), dialog_id,
[actor_id = actor_id(this), dialog_id, generation = d->save_draft_message_logevent_id_generation](Result<Unit> result) {
generation = d->save_draft_message_logevent_id_generation](Result<Unit> result) mutable {
if (!G()->close_flag()) { if (!G()->close_flag()) {
send_closure(actor_id, &MessagesManager::on_saved_dialog_draft_message, dialog_id, generation); send_closure(actor_id, &MessagesManager::on_saved_dialog_draft_message, dialog_id, generation);
} }
@ -12807,7 +12806,7 @@ void MessagesManager::update_dialog_notification_settings_on_server(DialogId dia
if (d->save_notification_settings_logevent_id != 0) { if (d->save_notification_settings_logevent_id != 0) {
promise = PromiseCreator::lambda( promise = PromiseCreator::lambda(
[actor_id = actor_id(this), dialog_id, [actor_id = actor_id(this), dialog_id,
generation = d->save_notification_settings_logevent_id_generation](Result<Unit> result) mutable { generation = d->save_notification_settings_logevent_id_generation](Result<Unit> result) {
if (!G()->close_flag()) { if (!G()->close_flag()) {
send_closure(actor_id, &MessagesManager::on_updated_dialog_notification_settings, dialog_id, generation); send_closure(actor_id, &MessagesManager::on_updated_dialog_notification_settings, dialog_id, generation);
} }
@ -13960,9 +13959,8 @@ void MessagesManager::read_history_on_server_impl(DialogId dialog_id, MessageId
Promise<> promise; Promise<> promise;
if (d->read_history_logevent_id != 0) { if (d->read_history_logevent_id != 0) {
promise = promise = PromiseCreator::lambda([actor_id = actor_id(this), dialog_id,
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, generation = d->read_history_logevent_id_generation](Result<Unit> result) {
generation = d->read_history_logevent_id_generation](Result<Unit> result) mutable {
if (!G()->close_flag()) { if (!G()->close_flag()) {
send_closure(actor_id, &MessagesManager::on_read_history_finished, dialog_id, generation); send_closure(actor_id, &MessagesManager::on_read_history_finished, dialog_id, generation);
} }
@ -16340,9 +16338,9 @@ void MessagesManager::on_upload_message_media_finished(int64 media_album_id, Dia
// send later, because some messages may be being deleted now // send later, because some messages may be being deleted now
for (auto request_message_id : request.message_ids) { for (auto request_message_id : request.message_ids) {
LOG(INFO) << "Send on_media_message_ready_to_send for " << request_message_id << " in " << dialog_id; LOG(INFO) << "Send on_media_message_ready_to_send for " << request_message_id << " in " << dialog_id;
send_closure_later( send_closure_later(actor_id(this), &MessagesManager::on_media_message_ready_to_send, dialog_id,
actor_id(this), &MessagesManager::on_media_message_ready_to_send, dialog_id, request_message_id, request_message_id,
PromiseCreator::lambda([actor_id = actor_id(this), media_album_id](Result<Message *> result) mutable { PromiseCreator::lambda([actor_id = actor_id(this), media_album_id](Result<Message *> result) {
if (result.is_error() || G()->close_flag()) { if (result.is_error() || G()->close_flag()) {
return; return;
} }

View File

@ -279,7 +279,7 @@ void PrivacyManager::get_privacy(tl_object_ptr<td_api::UserPrivacySetting> key,
create_storer(telegram_api::account_getPrivacy(user_privacy_setting.as_telegram_api()))); create_storer(telegram_api::account_getPrivacy(user_privacy_setting.as_telegram_api())));
send_with_promise(std::move(net_query), send_with_promise(std::move(net_query),
PromiseCreator::lambda([this, user_privacy_setting](Result<NetQueryPtr> x_net_query) mutable { PromiseCreator::lambda([this, user_privacy_setting](Result<NetQueryPtr> x_net_query) {
on_get_result(user_privacy_setting, [&]() -> Result<UserPrivacySettingRules> { on_get_result(user_privacy_setting, [&]() -> Result<UserPrivacySettingRules> {
TRY_RESULT(net_query, std::move(x_net_query)); TRY_RESULT(net_query, std::move(x_net_query));
TRY_RESULT(rules, fetch_result<telegram_api::account_getPrivacy>(std::move(net_query))); TRY_RESULT(rules, fetch_result<telegram_api::account_getPrivacy>(std::move(net_query)));

View File

@ -4429,7 +4429,7 @@ void Td::answer_ok_query(uint64 id, Status status) {
} }
Promise<Unit> Td::create_ok_request_promise(uint64 id) { Promise<Unit> Td::create_ok_request_promise(uint64 id) {
return PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<Unit> result) mutable { return PromiseCreator::lambda([id = id, actor_id = actor_id(this)](Result<Unit> result) {
if (result.is_error()) { if (result.is_error()) {
send_closure(actor_id, &Td::send_error, id, result.move_as_error()); send_closure(actor_id, &Td::send_error, id, result.move_as_error());
} else { } 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) { void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) {
CHECK_IS_USER(); CHECK_IS_USER();
CLEAN_INPUT_STRING(request.terms_of_service_id_); 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()) { if (result.is_error()) {
send_closure(actor_id, &Td::send_error, id, result.move_as_error()); send_closure(actor_id, &Td::send_error, id, result.move_as_error());
} else { } else {