refactor: fix clang-tidy auto*, const&, and curly braces (#5083)
This commit is contained in:
@@ -198,7 +198,9 @@ void Args::applyCustomChannelLayout(const QString &argValue)
|
||||
for (const WindowDescriptor &window : configLayout.windows_)
|
||||
{
|
||||
if (window.type_ != WindowType::Main)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return window.geometry_;
|
||||
}
|
||||
@@ -212,7 +214,9 @@ void Args::applyCustomChannelLayout(const QString &argValue)
|
||||
for (const QString &channelArg : channelArgList)
|
||||
{
|
||||
if (channelArg.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Twitch is default platform
|
||||
QString platform = "t";
|
||||
|
||||
@@ -82,7 +82,7 @@ LimitedQueueSnapshot<MessagePtr> Channel::getMessageSnapshot()
|
||||
void Channel::addMessage(MessagePtr message,
|
||||
std::optional<MessageFlags> overridingFlags)
|
||||
{
|
||||
auto app = getApp();
|
||||
auto *app = getApp();
|
||||
MessagePtr deleted;
|
||||
|
||||
if (!overridingFlags || !overridingFlags->has(MessageFlag::DoNotLog))
|
||||
@@ -135,7 +135,7 @@ void Channel::disableAllMessages()
|
||||
int snapshotLength = snapshot.size();
|
||||
for (int i = 0; i < snapshotLength; i++)
|
||||
{
|
||||
auto &message = snapshot[i];
|
||||
const auto &message = snapshot[i];
|
||||
if (message->flags.hasAny({MessageFlag::System, MessageFlag::Timeout,
|
||||
MessageFlag::Whisper}))
|
||||
{
|
||||
@@ -179,7 +179,7 @@ void Channel::fillInMissingMessages(const std::vector<MessagePtr> &messages)
|
||||
existingMessageIds.reserve(snapshot.size());
|
||||
|
||||
// First, collect the ids of every message already present in the channel
|
||||
for (auto &msg : snapshot)
|
||||
for (const auto &msg : snapshot)
|
||||
{
|
||||
if (msg->flags.has(MessageFlag::System) || msg->id.isEmpty())
|
||||
{
|
||||
@@ -196,7 +196,7 @@ void Channel::fillInMissingMessages(const std::vector<MessagePtr> &messages)
|
||||
// being able to insert just-loaded historical messages at the end
|
||||
// in the correct place.
|
||||
auto lastMsg = snapshot[snapshot.size() - 1];
|
||||
for (auto &msg : messages)
|
||||
for (const auto &msg : messages)
|
||||
{
|
||||
// check if message already exists
|
||||
if (existingMessageIds.count(msg->id) != 0)
|
||||
@@ -208,7 +208,7 @@ void Channel::fillInMissingMessages(const std::vector<MessagePtr> &messages)
|
||||
anyInserted = true;
|
||||
|
||||
bool insertedFlag = false;
|
||||
for (auto &snapshotMsg : snapshot)
|
||||
for (const auto &snapshotMsg : snapshot)
|
||||
{
|
||||
if (snapshotMsg->flags.has(MessageFlag::System))
|
||||
{
|
||||
|
||||
@@ -27,11 +27,15 @@ void ChatterSet::updateOnlineChatters(
|
||||
for (auto &&chatter : lowerCaseUsernames)
|
||||
{
|
||||
if (this->items.exists(chatter))
|
||||
{
|
||||
tmp.put(chatter, this->items.get(chatter));
|
||||
|
||||
// Less chatters than the limit => try to preserve as many as possible.
|
||||
// Less chatters than the limit => try to preserve as many as possible.
|
||||
}
|
||||
else if (lowerCaseUsernames.size() < chatterLimit)
|
||||
{
|
||||
tmp.put(chatter, chatter);
|
||||
}
|
||||
}
|
||||
|
||||
this->items = std::move(tmp);
|
||||
@@ -50,7 +54,9 @@ std::vector<QString> ChatterSet::filterByPrefix(const QString &prefix) const
|
||||
for (auto &&item : this->items)
|
||||
{
|
||||
if (item.first.startsWith(lowerPrefix))
|
||||
{
|
||||
result.push_back(item.second);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -56,9 +56,13 @@ public:
|
||||
void set(T flag, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this->set(flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->unset(flag);
|
||||
}
|
||||
}
|
||||
|
||||
bool has(T flag) const
|
||||
|
||||
@@ -308,10 +308,12 @@ public:
|
||||
for (auto &&x : list)
|
||||
{
|
||||
if (x.row() != list.first().row())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
auto data = new QMimeData;
|
||||
auto *data = new QMimeData;
|
||||
data->setData("chatterino_row_id", QByteArray::number(list[0].row()));
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user