Fixed some unused-but-set-variable warnings.

This commit is contained in:
23rd 2025-04-12 20:44:45 +03:00 committed by John Preston
parent 667e614bf3
commit 9ad1d1c25d
55 changed files with 98 additions and 99 deletions

View file

@ -28,8 +28,8 @@ constexpr auto kSearchPerPage = 50;
auto result = MessageIdsList();
for (const auto &message : messages) {
const auto peerId = PeerFromMessage(message);
if (const auto peer = data->peerLoaded(peerId)) {
if (const auto lastDate = DateFromMessage(message)) {
if (data->peerLoaded(peerId)) {
if (DateFromMessage(message)) {
const auto item = data->addNewMessage(
message,
MessageFlags(),

View file

@ -313,7 +313,7 @@ void PublicForwards::request(
const auto msgId = IdFromMessage(message);
const auto peerId = PeerFromMessage(message);
const auto lastDate = DateFromMessage(message);
if (const auto peer = owner.peerLoaded(peerId)) {
if (owner.peerLoaded(peerId)) {
if (!lastDate) {
return;
}

View file

@ -808,7 +808,7 @@ void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
updateTitle();
} else if (const auto channel = _peer ? _peer->asChannel() : nullptr) {
if (!_peer->isMegagroup()) {
showBox(Box<MaxInviteBox>(_peer->asChannel()));
showBox(Box<MaxInviteBox>(channel));
}
} else if (count >= serverConfig.chatSizeMax
&& count < serverConfig.megagroupSizeMax) {

View file

@ -453,7 +453,7 @@ void ChoosePeerBoxController::rowClicked(not_null<PeerListRow*> row) {
const auto onstack = callback;
onstack({ peer });
};
if (const auto user = peer->asUser()) {
if (peer->isUser()) {
done();
} else {
delegate()->peerListUiShow()->showBox(

View file

@ -689,7 +689,7 @@ UserData *ParticipantsAdditionalData::applyAdmin(
const auto user = _peer->owner().userLoaded(data.userId());
if (!user) {
return nullptr;
} else if (const auto chat = _peer->asChat()) {
} else if (_peer->isChat()) {
// This can come from saveAdmin callback.
_admins.emplace(user);
return user;
@ -733,7 +733,7 @@ UserData *ParticipantsAdditionalData::applyRegular(UserId userId) {
const auto user = _peer->owner().userLoaded(userId);
if (!user) {
return nullptr;
} else if (const auto chat = _peer->asChat()) {
} else if (_peer->isChat()) {
// This can come from saveAdmin or saveRestricted callback.
_admins.erase(user);
return user;
@ -913,7 +913,7 @@ void ParticipantsBoxController::setupListChangeViewers() {
return;
}
}
if (const auto row = delegate()->peerListFindRow(user->id.value)) {
if (delegate()->peerListFindRow(user->id.value)) {
delegate()->peerListPartitionRows([&](const PeerListRow &row) {
return (row.peer() == user);
});

View file

@ -1793,7 +1793,7 @@ void SendGiftBox(
ShowSentToast(window, details.descriptor, details);
}
if (const auto strong = weak.data()) {
box->closeBox();
strong->closeBox();
}
};
SendGift(window, peer, api, details, done);

View file

@ -1510,7 +1510,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
sticker->paintRequest(
) | rpl::start_with_next([=] {
auto p = Painter(sticker);
if (const auto strong = weak.data()) {
if ([[maybe_unused]] const auto strong = weak.data()) {
const auto paused = On(PowerSaving::kStickersPanel)
|| show->paused(ChatHelpers::PauseReason::Layer);
paintSticker(p, index, QPoint(), paused, crl::now());
@ -1564,7 +1564,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox(
Data::StickersType::Stickers);
}, [](const auto &) {
});
if (const auto strong = weak.data()) {
if ([[maybe_unused]] const auto strong = weak.data()) {
applySet(result);
}
if (const auto strongBox = weakBox.data()) {

View file

@ -144,7 +144,7 @@ void UrlAuthBox::Request(
const auto callback = [=](Result result) {
if (result == Result::None) {
finishWithUrl(url);
} else if (const auto msg = session->data().message(itemId)) {
} else if (session->data().message(itemId)) {
const auto allowWrite = (result == Result::AuthAndAllowWrite);
using Flag = MTPmessages_AcceptUrlAuth::Flag;
const auto flags = (allowWrite ? Flag::f_write_allowed : Flag(0))

View file

@ -611,7 +611,7 @@ void BoxController::receivedCalls(const QVector<MTPMessage> &result) {
for (const auto &message : result) {
const auto msgId = IdFromMessage(message);
const auto peerId = PeerFromMessage(message);
if (const auto peer = session().data().peerLoaded(peerId)) {
if (session().data().peerLoaded(peerId)) {
const auto item = session().data().addNewMessage(
message,
MessageFlags(),

View file

@ -2104,7 +2104,7 @@ void EmojiListWidget::colorChosen(EmojiChosen data) {
const auto emoji = data.emoji;
auto &settings = Core::App().settings();
if (const auto button = std::get_if<OverButton>(&_pickerSelected)) {
if (v::is<OverButton>(_pickerSelected)) {
settings.saveAllEmojiVariants(emoji);
for (auto section = int(Section::People)
; section < _staticCount
@ -2425,7 +2425,7 @@ Ui::Text::CustomEmoji *EmojiListWidget::resolveCustomRecent(
const auto &data = customId.data;
if (const auto document = std::get_if<RecentEmojiDocument>(&data)) {
return resolveCustomRecent(document->id);
} else if (const auto emoji = std::get_if<EmojiPtr>(&data)) {
} else if (v::is<EmojiPtr>(data)) {
return nullptr;
}
Unexpected("Custom recent emoji id.");

View file

@ -765,7 +765,7 @@ InlineBotQuery ParseInlineBotQuery(
result.username = username.toString();
if (const auto peer = session->data().peerByUsername(result.username)) {
if (const auto user = peer->asUser()) {
result.bot = peer->asUser();
result.bot = user;
} else {
result.bot = nullptr;
}

View file

@ -25,7 +25,7 @@ Ui::LocationPicker *LocationPickers::lookup(const Api::SendAction &action) {
for (auto i = begin(_pickers); i != end(_pickers);) {
if (const auto strong = i->picker.get()) {
if (i->action == action) {
return i->picker.get();
return strong;
}
++i;
} else {
@ -41,4 +41,4 @@ void LocationPickers::emplace(
_pickers.push_back({ action, picker });
}
} // namespace Data
} // namespace Data

View file

@ -956,7 +956,7 @@ QString ChannelData::invitePeekHash() const {
}
void ChannelData::privateErrorReceived() {
if (const auto expires = invitePeekExpires()) {
if (invitePeekExpires()) {
const auto hash = invitePeekHash();
for (const auto &window : session().windows()) {
clearInvitePeek();

View file

@ -347,7 +347,7 @@ bool ChatFilter::contains(
: user->isContact()
? Flag::Contacts
: Flag::NonContacts;
} else if (const auto chat = peer->asChat()) {
} else if (peer->isChat()) {
return Flag::Groups;
} else if (const auto channel = peer->asChannel()) {
if (channel->isBroadcast()) {

View file

@ -238,7 +238,7 @@ void CloudThemes::showPreview(
void CloudThemes::showPreview(
not_null<Window::Controller*> controller,
const CloudTheme &cloud) {
if (const auto documentId = cloud.documentId) {
if (cloud.documentId) {
previewFromDocument(controller, cloud);
} else if (cloud.createdBy == _session->userId()) {
controller->show(Box(

View file

@ -1111,7 +1111,7 @@ ItemPreview MediaFile::toPreview(ToPreviewOptions options) const {
return toGroupPreview(group->items, options);
}
}
if (const auto sticker = _document->sticker()) {
if (_document->sticker()) {
return Media::toPreview(options);
}
auto images = std::vector<ItemPreviewImage>();
@ -1178,7 +1178,7 @@ ItemPreview MediaFile::toPreview(ToPreviewOptions options) const {
}
TextWithEntities MediaFile::notificationText() const {
if (const auto sticker = _document->sticker()) {
if (_document->sticker()) {
const auto text = _emoji.isEmpty()
? tr::lng_in_dlg_sticker(tr::now)
: tr::lng_in_dlg_sticker_emoji(tr::now, lt_emoji, _emoji);
@ -1210,7 +1210,7 @@ TextWithEntities MediaFile::notificationText() const {
}
QString MediaFile::pinnedTextSubstring() const {
if (const auto sticker = _document->sticker()) {
if (_document->sticker()) {
if (!_emoji.isEmpty()) {
return tr::lng_action_pinned_media_emoji_sticker(
tr::now,

View file

@ -703,7 +703,7 @@ bool PeerData::canTransferGifts() const {
bool PeerData::canEditMessagesIndefinitely() const {
if (const auto user = asUser()) {
return user->isSelf();
} else if (const auto chat = asChat()) {
} else if (isChat()) {
return false;
} else if (const auto channel = asChannel()) {
return channel->isMegagroup()
@ -1410,7 +1410,7 @@ Data::ForumTopic *PeerData::forumTopicFor(MsgId rootId) const {
}
bool PeerData::allowsForwarding() const {
if (const auto user = asUser()) {
if (isUser()) {
return true;
} else if (const auto channel = asChannel()) {
return channel->allowsForwarding();

View file

@ -599,7 +599,7 @@ rpl::producer<int> UniqueReactionsLimitValue(
) | rpl::map([config = &peer->session().appConfig()] {
return UniqueReactionsLimit(config);
}) | rpl::distinct_until_changed();
if (const auto channel = peer->asChannel()) {
if (peer->isChannel()) {
return rpl::combine(
PeerAllowedReactionsValue(peer),
std::move(configValue)
@ -608,7 +608,7 @@ rpl::producer<int> UniqueReactionsLimitValue(
? allowedReactions.maxCount
: limit;
});
} else if (const auto chat = peer->asChat()) {
} else if (peer->isChat()) {
return rpl::combine(
PeerAllowedReactionsValue(peer),
std::move(configValue)

View file

@ -65,13 +65,13 @@ QByteArray PhotoMedia::imageBytes(PhotoSize size) const {
auto PhotoMedia::resolveLoadedImage(PhotoSize size) const
-> const PhotoImage * {
const auto &original = _images[PhotoSizeIndex(size)];
if (const auto image = original.data.get()) {
if (original.data) {
if (original.goodFor >= size) {
return &original;
}
}
const auto &valid = _images[_owner->validSizeIndex(size)];
if (const auto image = valid.data.get()) {
if (valid.data.get()) {
if (valid.goodFor >= size) {
return &valid;
}

View file

@ -366,7 +366,7 @@ bool RepliesList::buildFromData(not_null<Viewer*> viewer) {
const auto around = [&] {
if (viewer->around != ShowAtUnreadMsgId) {
return viewer->around;
} else if (const auto item = lookupRoot()) {
} else if (lookupRoot()) {
return computeInboxReadTillFull();
} else if (_owningTopic) {
// Somehow we don't want always to jump to computed inboxReadTill

View file

@ -2231,7 +2231,7 @@ void Session::applyDialog(
}
bool Session::pinnedCanPin(not_null<Dialogs::Entry*> entry) const {
if (const auto sublist = entry->asSublist()) {
if ([[maybe_unused]] const auto sublist = entry->asSublist()) {
const auto saved = &savedMessages();
return pinnedChatsOrder(saved).size() < pinnedChatsLimit(saved);
} else if (const auto topic = entry->asTopic()) {

View file

@ -4756,7 +4756,7 @@ bool InnerWidget::chooseRow(
}
if (!chosen.message.fullId) {
if (const auto history = chosen.key.history()) {
if (const auto forum = history->peer->forum()) {
if (history->peer->forum()) {
if (pressedTopicRootId) {
chosen.message.fullId = {
history->peer->id,

View file

@ -806,7 +806,7 @@ void Widget::setupSwipeBack() {
}
return Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
_swipeBackData = {};
if (const auto forum = controller()->shownForum().current()) {
if (controller()->shownForum().current()) {
controller()->closeForum();
}
});

View file

@ -952,7 +952,7 @@ void MyChannelsController::prepare() {
const auto add = [&](not_null<Dialogs::MainList*> list) {
for (const auto &row : list->indexed()->all()) {
if (const auto history = row->history()) {
if (const auto channel = history->peer->asBroadcast()) {
if (history->peer->isBroadcast()) {
_channels.push_back(history);
}
}
@ -981,7 +981,7 @@ void MyChannelsController::prepare() {
const auto list = owner->chatsList(folder);
for (const auto &row : list->indexed()->all()) {
if (const auto history = row->history()) {
if (const auto channel = history->peer->asBroadcast()) {
if (history->peer->isBroadcast()) {
if (ranges::contains(_channels, not_null(history))) {
_channels.push_back(history);
}

View file

@ -1724,9 +1724,9 @@ File &Message::file() {
} else if (const auto photo = std::get_if<ActionSuggestProfilePhoto>(
content)) {
return photo->photo.image.file;
} else if (const auto wallpaper = std::get_if<ActionSetChatWallPaper>(
content)) {
// #TODO wallpapers
// } else if (const auto wallpaper = std::get_if<ActionSetChatWallPaper>(
// content)) {
// #TODO wallpapers
}
return media.file();
}
@ -1738,9 +1738,9 @@ const File &Message::file() const {
} else if (const auto photo = std::get_if<ActionSuggestProfilePhoto>(
content)) {
return photo->photo.image.file;
} else if (const auto wallpaper = std::get_if<ActionSetChatWallPaper>(
content)) {
// #TODO wallpapers
// } else if (const auto wallpaper = std::get_if<ActionSetChatWallPaper>(
// content)) {
// #TODO wallpapers
}
return media.file();
}

View file

@ -190,7 +190,7 @@ void History::itemVanished(not_null<HistoryItem*> item) {
setUnreadCount(unreadCount() - 1);
}
if (const auto media = item->media()) {
if (const auto gift = media->gift()) {
if (media->gift()) {
using GiftAction = Data::GiftUpdate::Action;
owner().notifyGiftUpdate({
.id = Data::SavedStarGiftId::User(item->id),
@ -1160,7 +1160,7 @@ void History::applyServiceChanges(
auto paid = std::optional<Payments::PaidInvoice>();
if (const auto message = payment->msg) {
if (const auto media = message->media()) {
if (const auto invoice = media->invoice()) {
if (media->invoice()) {
paid = Payments::CheckoutProcess::InvoicePaid(
message);
}
@ -2555,7 +2555,7 @@ auto History::computeChatListMessageFromLast() const
if (!last || !last->isGroupMigrate()) {
return _lastMessage;
}
if (const auto chat = peer->asChat()) {
if (peer->isChat()) {
// In chats we try to take the item before the 'last', which
// is the empty-displayed migration message.
if (!loadedAtBottom()) {
@ -2633,7 +2633,7 @@ void History::setFakeChatListMessage() {
}
}
return;
} else if (const auto chat = peer->asChat()) {
} else if (peer->isChat()) {
// In chats we try to take the item before the 'last', which
// is the empty-displayed migration message.
owner().histories().requestFakeChatListMessage(this);
@ -2876,10 +2876,8 @@ void History::dialogEntryApplied() {
addOlderSlice(QVector<MTPMessage>());
if (const auto channel = peer->asChannel()) {
const auto inviter = channel->inviter;
if (inviter && channel->amIn()) {
if (const auto from = owner().userLoaded(inviter)) {
insertJoinedMessage();
}
if (inviter && channel->amIn() && owner().userLoaded(inviter)) {
insertJoinedMessage();
}
}
return;
@ -2890,10 +2888,9 @@ void History::dialogEntryApplied() {
const auto inviter = channel->inviter;
if (inviter
&& chatListTimeId() <= channel->inviteDate
&& channel->amIn()) {
if (const auto from = owner().userLoaded(inviter)) {
insertJoinedMessage();
}
&& channel->amIn()
&& owner().userLoaded(inviter)) {
insertJoinedMessage();
}
}
}

View file

@ -2495,9 +2495,12 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
const auto itemId = item->fullId();
_menu->addAction(tr::lng_context_select_msg(tr::now), [=] {
if (const auto item = session->data().message(itemId)) {
if (const auto view = viewByItem(item)) {
if ([[maybe_unused]] const auto view = viewByItem(item)) {
if (asGroup) {
changeSelectionAsGroup(&_selected, item, SelectAction::Select);
changeSelectionAsGroup(
&_selected,
item,
SelectAction::Select);
} else {
changeSelection(&_selected, item, SelectAction::Select);
}
@ -4628,7 +4631,7 @@ void HistoryInner::reportAsGroup(FullMsgId itemId) {
}
void HistoryInner::blockSenderItem(FullMsgId itemId) {
if (const auto item = session().data().message(itemId)) {
if ([[maybe_unused]] const auto item = session().data().message(itemId)) {
_controller->show(Box(
Window::BlockSenderFromRepliesBox,
_controller,

View file

@ -2263,7 +2263,7 @@ void HistoryItem::setRealId(MsgId newId) {
_history->owner().groups().refreshMessage(this);
_history->owner().requestItemResize(this);
if (const auto reply = Get<HistoryMessageReply>()) {
if (Has<HistoryMessageReply>()) {
incrementReplyToTopCounter();
}
@ -2440,7 +2440,7 @@ bool HistoryItem::canDeleteForEveryone(TimeId now) const {
bool HistoryItem::suggestReport() const {
if (out() || isService() || !isRegular()) {
return false;
} else if (const auto channel = _history->peer->asChannel()) {
} else if (_history->peer->isChannel()) {
return true;
} else if (const auto user = _history->peer->asUser()) {
return user->isBot();
@ -3731,7 +3731,7 @@ void HistoryItem::createComponents(CreateConfig &&config) {
if (const auto via = Get<HistoryMessageVia>()) {
via->create(&_history->owner(), config.viaBotId);
}
if (const auto views = Get<HistoryMessageViews>()) {
if (Has<HistoryMessageViews>()) {
changeViewsCount(config.viewsCount);
if (config.replies.isNull
&& isSending()

View file

@ -1208,7 +1208,7 @@ void ClearMediaAsExpired(not_null<HistoryItem*> item) {
? tr::lng_ttl_round_expired
: tr::lng_message_empty)(tr::now, Ui::Text::WithEntities);
item->updateServiceText(PreparedServiceText{ std::move(text) });
} else if (const auto photo = media->photo()) {
} else if (media->photo()) {
item->applyEditionToHistoryCleared();
item->updateServiceText(PreparedServiceText{
tr::lng_ttl_photo_expired(tr::now, Ui::Text::WithEntities)

View file

@ -7416,7 +7416,7 @@ bool HistoryWidget::showSlowmodeError() {
Ui::FormatDurationWordsSlowmode(left));
} else if (_peer->slowmodeApplied()) {
if (const auto item = _history->latestSendingMessage()) {
if (const auto view = item->mainView()) {
if (item->mainView()) {
animatedScrollToItem(item->id);
enqueueMessageHighlight({ item });
}

View file

@ -102,7 +102,7 @@ void ForwardPanel::checkTexts() {
for (const auto item : _data.items) {
if (const auto from = item->originalSender()) {
version += from->nameVersion();
} else if (const auto info = item->originalHiddenSenderInfo()) {
} else if (item->originalHiddenSenderInfo()) {
++version;
} else {
Unexpected("Corrupt forwarded information in message.");

View file

@ -198,7 +198,7 @@ ClickHandlerPtr BottomInfo::replayEffectLink(
const auto weak = base::make_weak(view);
return std::make_shared<LambdaClickHandler>([=](ClickContext context) {
const auto my = context.other.value<ClickHandlerContext>();
if (const auto controller = my.sessionWindow.get()) {
if ([[maybe_unused]] const auto controller = my.sessionWindow.get()) {
if (const auto strong = weak.get()) {
strong->delegate()->elementStartEffect(strong, nullptr);
}

View file

@ -1440,11 +1440,11 @@ void AddSaveSoundForNotifications(
return;
} else if (int(ringtones.list().size()) >= ringtones.maxSavedCount()) {
return;
} else if (const auto song = document->song()) {
} else if (document->song()) {
if (document->duration() > ringtones.maxDuration()) {
return;
}
} else if (const auto voice = document->voice()) {
} else if (document->voice()) {
if (document->duration() > ringtones.maxDuration()) {
return;
}

View file

@ -1489,7 +1489,7 @@ void ListWidget::cancelSelection() {
void ListWidget::selectItem(not_null<HistoryItem*> item) {
if (hasSelectRestriction()) {
return;
} else if (const auto view = viewForItem(item)) {
} else if ([[maybe_unused]] const auto view = viewForItem(item)) {
clearTextSelection();
changeSelection(
_selected,
@ -1502,7 +1502,7 @@ void ListWidget::selectItem(not_null<HistoryItem*> item) {
void ListWidget::selectItemAsGroup(not_null<HistoryItem*> item) {
if (hasSelectRestriction()) {
return;
} else if (const auto view = viewForItem(item)) {
} else if ([[maybe_unused]] const auto view = viewForItem(item)) {
clearTextSelection();
changeSelectionAsGroup(
_selected,

View file

@ -2477,7 +2477,7 @@ bool Message::hasFromPhoto() const {
return true;
} else if (item->history()->peer->isVerifyCodes()) {
return !hasOutLayout();
} else if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
} else if (item->Has<HistoryMessageForwarded>()) {
const auto peer = item->history()->peer;
if (peer->isSelf() || peer->isRepliesChat()) {
return !hasOutLayout();
@ -3136,7 +3136,7 @@ void Message::updatePressed(QPoint point) {
if (const auto reply = Get<Reply>()) {
trect.setTop(trect.top() + reply->height());
}
if (const auto via = item->Get<HistoryMessageVia>()) {
if (item->Has<HistoryMessageVia>()) {
if (!displayFromName() && !displayForwardedFrom()) {
trect.setTop(trect.top() + st::msgNameFont->height);
}
@ -4447,7 +4447,7 @@ Ui::BubbleRounding Message::countMessageRounding() const {
Ui::BubbleRounding Message::countBubbleRounding(
Ui::BubbleRounding messageRounding) const {
if (const auto keyboard = data()->inlineReplyKeyboard()) {
if ([[maybe_unused]] const auto _ = data()->inlineReplyKeyboard()) {
messageRounding.bottomLeft
= messageRounding.bottomRight
= Ui::BubbleCornerRounding::Small;

View file

@ -738,7 +738,7 @@ void TopBarWidget::infoClicked() {
return;
} else if (const auto topic = key.topic()) {
_controller->showSection(std::make_shared<Info::Memento>(topic));
} else if (const auto sublist = key.sublist()) {
} else if ([[maybe_unused]] const auto sublist = key.sublist()) {
_controller->showSection(std::make_shared<Info::Memento>(
_controller->session().user(),
Info::Section(Storage::SharedMediaType::Photo)));

View file

@ -271,10 +271,10 @@ void PaintWaveform(
};
add(FormatDownloadText(document->size, document->size));
const auto duration = document->duration() / 1000;
if (const auto song = document->song()) {
if (document->song()) {
add(FormatPlayedText(duration, duration));
add(FormatDurationAndSizeText(duration, document->size));
} else if (const auto voice = document->voice() ? document->voice() : document->round()) {
} else if (document->voice() ? document->voice() : document->round()) {
add(FormatPlayedText(duration, duration));
add(FormatDurationAndSizeText(duration, document->size));
} else if (document->isVideoFile()) {

View file

@ -448,7 +448,7 @@ void StickerInBubblePart::ensureCreated(Element *replacing) const {
return;
} else if (const auto data = _lookup()) {
const auto sticker = data.sticker;
if (const auto info = sticker->sticker()) {
if (sticker->sticker()) {
const auto skipPremiumEffect = true;
_link = data.link;
_skipTop = data.skipTop;

View file

@ -411,7 +411,7 @@ void PremiumGift::ensureStickerCreated() const {
const auto count = credits();
const auto months = count ? packs.monthsForStars(count) : _data.count;
if (const auto document = packs.lookup(months)) {
if (const auto sticker = document->sticker()) {
if (document->sticker()) {
const auto skipPremiumEffect = false;
_sticker.emplace(_parent, document, skipPremiumEffect, _parent);
_sticker->setPlayingOnce(true);

View file

@ -751,7 +751,7 @@ void InnerWidget::setupEnd() {
*sent = false;
if (!success) {
return;
} else if (const auto strong = weak.data()) {
} else if ([[maybe_unused]] const auto strong = weak.data()) {
_controller->showBackFromStack();
window->showToast({
.title = tr::lng_star_ref_ended_title(tr::now),

View file

@ -861,7 +861,7 @@ rpl::producer<uint64> AddCurrencyAction(
) | rpl::start_with_error_done([=](const QString &error) {
currencyLoadLifetime->destroy();
}, [=] {
if (const auto strong = weak.data()) {
if ([[maybe_unused]] const auto strong = weak.data()) {
state->balance = currencyLoad->data().currentBalance;
currencyLoadLifetime->destroy();
}

View file

@ -100,7 +100,7 @@ void Widget::setInnerFocus() {
}
rpl::producer<QString> Widget::title() {
if (const auto topic = controller()->key().topic()) {
if (controller()->key().topic()) {
return tr::lng_info_topic_title();
}
const auto peer = controller()->key().peer();

View file

@ -1582,11 +1582,11 @@ TextState Game::getState(
}
void Game::prepareThumbnail(QSize size) const {
if (const auto document = getResultDocument()) {
if ([[maybe_unused]] const auto document = getResultDocument()) {
Assert(_documentMedia != nullptr);
validateThumbnail(_documentMedia->thumbnail(), size, true);
validateThumbnail(_documentMedia->thumbnailInline(), size, false);
} else if (const auto photo = getResultPhoto()) {
} else if ([[maybe_unused]] const auto photo = getResultPhoto()) {
using Data::PhotoSize;
Assert(_photoMedia != nullptr);
validateThumbnail(_photoMedia->image(PhotoSize::Thumbnail), size, true);

View file

@ -1166,7 +1166,7 @@ float64 MainWidget::chatBackgroundProgress() const {
if (_background) {
if (_background->generating) {
return 1.;
} else if (const auto document = _background->data.document()) {
} else if (_background->data.document()) {
return _background->dataMedia->progress();
}
}
@ -2602,7 +2602,7 @@ auto MainWidget::thirdSectionForCurrentMainSection(
return std::make_shared<Info::Memento>(
peer,
Info::Memento::DefaultSection(peer));
} else if (const auto sublist = key.sublist()) {
} else if (key.sublist()) {
return std::make_shared<Info::Memento>(
session().user(),
Info::Memento::DefaultSection(session().user()));

View file

@ -642,7 +642,7 @@ void Widget::updateTimeText(const TrackState &state) {
display = state.position;
} else if (state.length) {
display = state.length;
} else if (const auto song = document->song()) {
} else if (document->song()) {
display = (document->duration() * frequency) / 1000;
}

View file

@ -905,8 +905,7 @@ bool ReplyArea::showSlowmodeError() {
lt_left,
Ui::FormatDurationWordsSlowmode(left));
} else if (peer->slowmodeApplied()) {
const auto history = peer->owner().history(peer);
if (const auto item = history->latestSendingMessage()) {
if (peer->owner().history(peer)->latestSendingMessage()) {
return tr::lng_slowmode_no_many(tr::now);
}
}

View file

@ -1017,7 +1017,7 @@ const style::RoundCheckbox &Voice::checkboxStyle() const {
}
void Voice::updateName() {
if (const auto forwarded = parent()->Get<HistoryMessageForwarded>()) {
if (parent()->Has<HistoryMessageForwarded>()) {
const auto info = parent()->originalHiddenSenderInfo();
const auto name = info
? tr::lng_forwarded(tr::now, lt_user, info->nameText().toString())

View file

@ -1895,7 +1895,7 @@ void GenericCreditsEntryBox(
ProcessReceivedSubscriptions(weak, session);
};
const auto fail = [=, show = box->uiShow()](const QString &e) {
if (const auto strong = weak.data()) {
if ([[maybe_unused]] const auto strong = weak.data()) {
state->confirmButtonBusy = false;
}
show->showToast(e);

View file

@ -911,7 +911,7 @@ void SetupTagContent(
const auto send = [=, weak = Ui::MakeWeak(tagsButton)](bool checked) {
session->data().chatsFilters().requestToggleTags(checked, [=] {
if (const auto strong = weak.data()) {
if ([[maybe_unused]] const auto strong = weak.data()) {
state->tagsTurnOff.fire(!checked);
}
});

View file

@ -418,7 +418,7 @@ void WebLoadManager::failed(
}
void WebLoadManager::failed(int id, not_null<QNetworkReply*> reply) {
if (const auto sent = findSent(id, reply)) {
if ([[maybe_unused]] const auto sent = findSent(id, reply)) {
removeSent(id);
queueFailedUpdate(id);
}

View file

@ -319,7 +319,7 @@ void PrepareDetails(PreparedFile &file, int previewWidth, int sideLimit) {
file.preview.setDevicePixelRatio(style::DevicePixelRatio());
file.type = PreparedFile::Type::Video;
}
} else if (const auto song = std::get_if<Song>(&file.information->media)) {
} else if (v::is<Song>(file.information->media)) {
file.type = PreparedFile::Type::Music;
}
}

View file

@ -241,7 +241,7 @@ void GroupCallUserpics::sendRandomLevels() {
for (auto &userpic : _list) {
if (const auto blobs = userpic.blobsAnimation.get()) {
const auto value = 30 + base::RandomIndex(70);
userpic.blobsAnimation->blobs.setLevel(float64(value) / 100.);
blobs->blobs.setLevel(float64(value) / 100.);
}
}
}

View file

@ -385,10 +385,10 @@ int ReactionFlyAnimation::computeParabolicTop(
void ReactionFlyAnimation::startAnimations() {
if (const auto center = _center.get()) {
_center->animate(callback());
center->animate(callback());
}
if (const auto effect = _effect.get()) {
_effect->animate(callback());
effect->animate(callback());
} else if (_scaleOutDuration > 0) {
_noEffectScaleStarted = true;
_noEffectScaleAnimation.start(callback(), 1, 0, _scaleOutDuration);

View file

@ -378,7 +378,7 @@ void ChatsFiltersTabs::setHorizontalShift(int index, int shift) {
Expects(index >= 0 && index < _sections.size());
auto &section = _sections[index];
if (const auto delta = shift - section.horizontalShift) {
if (shift - section.horizontalShift) {
section.horizontalShift = shift;
update();
}

View file

@ -585,7 +585,7 @@ void Filler::addStoryArchive() {
const auto controller = _controller;
const auto weak = base::make_weak(_thread);
_addAction(tr::lng_stories_archive_button(tr::now), [=] {
if (const auto strong = weak.get()) {
if ([[maybe_unused]] const auto strong = weak.get()) {
controller->showSection(Info::Stories::Make(
channel,
Info::Stories::Tab::Archive));
@ -1096,7 +1096,7 @@ void Filler::addViewStatistics() {
= (channel->flags() & Flag::CanViewCreditsRevenue);
if (canGetStats) {
_addAction(tr::lng_stats_title(tr::now), [=] {
if (const auto strong = weak.get()) {
if ([[maybe_unused]] const auto strong = weak.get()) {
using namespace Info;
controller->showSection(Statistics::Make(peer, {}, {}));
}
@ -1106,14 +1106,14 @@ void Filler::addViewStatistics() {
|| channel->amCreator()
|| channel->canPostStories()) {
_addAction(tr::lng_boosts_title(tr::now), [=] {
if (const auto strong = weak.get()) {
if ([[maybe_unused]] const auto strong = weak.get()) {
controller->showSection(Info::Boosts::Make(peer));
}
}, &st::menuIconBoosts);
}
if (canViewEarn || canViewCreditsEarn) {
_addAction(tr::lng_channel_earn_title(tr::now), [=] {
if (const auto strong = weak.get()) {
if ([[maybe_unused]] const auto strong = weak.get()) {
controller->showSection(Info::ChannelEarn::Make(peer));
}
}, &st::menuIconEarn);