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>());
CHECK(it_flag.second);
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));
});
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) {
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()) {
td->create_handler<GetFullChatQuery>(promise.move_as_ok())->send(chat_id);
}

View File

@ -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<Unit> result) mutable {
file_manager = G()->file_manager()](Result<Unit> 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<Unit> 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<Unit> 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 {

View File

@ -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<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,
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,

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),
thumbnail_file_id](Result<BufferSlice> r_thumbnail) mutable {
thumbnail_file_id](Result<BufferSlice> 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<Unit> 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<Unit> 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<Unit> result) mutable {
generation = d->save_notification_settings_logevent_id_generation](Result<Unit> 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<Unit> 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<Unit> 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<Message *> 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<Message *> 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);
}));
}
}
}

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())));
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> {
TRY_RESULT(net_query, std::move(x_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) {
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()) {
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 {