Commit 8468c7cf authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent 05860c7e
Pipeline #21115 passed with stage
in 25 minutes and 41 seconds
......@@ -97,7 +97,7 @@ public:
}
if (!memento) {
if (!a.emails().isEmpty()) {
lst.append(a.emails().first());
lst.append(a.emails().constFirst());
count++;
}
}
......@@ -211,7 +211,7 @@ public:
KPIM::AddContactJob *job = new KPIM::AddContactJob(a, nullptr);
job->start();
} else if (path.startsWith(QLatin1String("updateToAddressBook"))) {
UpdateContactJob *job = new UpdateContactJob(a.emails().first(), a, nullptr);
UpdateContactJob *job = new UpdateContactJob(a.emails().constFirst(), a, nullptr);
job->start();
}
......
......@@ -182,8 +182,7 @@ QString FancyHeaderStyle::format(KMime::Message *message) const
headerStr.append(QStringLiteral("<tr><th>%1</th>\n"
"<td dir=\"%2\">%3</td></tr>\n")
.arg(i18n("Date: "))
.arg(mHeaderStyleUtil.directionOf(HeaderStyleUtil::dateStr(message->date()->dateTime())))
.arg(mHeaderStyleUtil.strToHtml(HeaderStyleUtil::dateString(message, /* short = */ MessageViewer::HeaderStyleUtil::CustomDate))));
.arg(mHeaderStyleUtil.directionOf(HeaderStyleUtil::dateStr(message->date()->dateTime())), mHeaderStyleUtil.strToHtml(HeaderStyleUtil::dateString(message, /* short = */ MessageViewer::HeaderStyleUtil::CustomDate))));
}
if (strategy->showHeader(QStringLiteral("x-bugzilla-url"))) {
......
......@@ -68,7 +68,8 @@ void ViewerPluginCreatenoteInterface::closePlugin()
Akonadi::Relation ViewerPluginCreatenoteInterface::relatedNoteRelation() const
{
Akonadi::Relation relation;
for (const Akonadi::Relation &r : mMessageItem.relations()) {
const auto relations = mMessageItem.relations();
for (const Akonadi::Relation &r : relations) {
// assuming that GENERIC relations to emails are notes is a pretty horrific hack imo - aseigo
if (r.type() == Akonadi::Relation::GENERIC && r.right().mimeType() == Akonadi::NoteUtils::noteMimeType()) {
relation = r;
......
......@@ -181,7 +181,7 @@ void EventDataVisitorTest::testExplodeIncidenceOccurences_data()
}
QTest::newRow(qPrintable(testData)) << parser.rangeStart()
<< parser.rangeEnd()
<< parser.eventData().first()
<< parser.eventData().constFirst()
<< parser.incidence()
<< parser.akonadiId()
<< parser.eventData();
......
......@@ -107,7 +107,7 @@ void PimEventsPluginTest::testLoadEventsForDataRange()
plugin.loadEventsForDateRange(QDate(2016, 5, 1), QDate(2016, 5, 31));
QCOMPARE(dataReadySpy.size(), 1);
const auto results = dataReadySpy.takeFirst().first().value<DateEventDataHash>();
const auto results = dataReadySpy.takeFirst().constFirst().value<DateEventDataHash>();
QVERIFY(compareEventDataHashes(results, expectedData));
plugin.loadEventsForDateRange(QDate(2016, 1, 1), QDate(2016, 1, 30));
......
......@@ -158,7 +158,8 @@ void AdBlockMatcher::update()
QHash<QString, const AdBlockRule *> cssRulesHash;
QVector<const AdBlockRule *> exceptionCssRules;
for (AdBlockSubscription *subscription : mManager->subscriptions()) {
const auto subscriptions = mManager->subscriptions();
for (AdBlockSubscription *subscription : subscriptions) {
for (const AdBlockRule *rule : subscription->allRules()) {
// Don't add internally disabled rules to cache
if (rule->isInternalDisabled()) {
......
......@@ -747,22 +747,22 @@ QStringList AdBlockRule::parseRegExpFilter(const QString &filter) const
return list;
}
bool AdBlockRule::hasOption(const AdBlockRule::RuleOption &opt) const
bool AdBlockRule::hasOption(AdBlockRule::RuleOption opt) const
{
return m_options & opt;
}
bool AdBlockRule::hasException(const AdBlockRule::RuleOption &opt) const
bool AdBlockRule::hasException(AdBlockRule::RuleOption opt) const
{
return m_exceptions & opt;
}
void AdBlockRule::setOption(const AdBlockRule::RuleOption &opt)
void AdBlockRule::setOption(AdBlockRule::RuleOption opt)
{
m_options |= opt;
}
void AdBlockRule::setException(const AdBlockRule::RuleOption &opt, bool on)
void AdBlockRule::setException(AdBlockRule::RuleOption opt, bool on)
{
if (on) {
m_exceptions |= opt;
......
......@@ -149,11 +149,11 @@ private:
Q_DECLARE_FLAGS(RuleOptions, RuleOption)
inline bool hasOption(const RuleOption &opt) const;
inline bool hasException(const RuleOption &opt) const;
inline bool hasOption(RuleOption opt) const;
inline bool hasException(RuleOption opt) const;
inline void setOption(const RuleOption &opt);
inline void setException(const RuleOption &opt, bool on);
inline void setOption(RuleOption opt);
inline void setException(RuleOption opt, bool on);
void parseFilter();
void parseDomains(const QString &domains, QChar separator);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment