Commit 40684369 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warnings

parent f2360a19
Pipeline #150025 passed with stage
in 1 minute and 45 seconds
......@@ -188,9 +188,10 @@ Term recursiveEmailTermMapping(const Akonadi::SearchTerm &term)
Term recursiveCalendarTermMapping(const Akonadi::SearchTerm &term)
{
if (!term.subTerms().isEmpty()) {
const auto subTerms{term.subTerms()};
if (!subTerms.isEmpty()) {
Term t(mapRelation(term.relation()));
for (const Akonadi::SearchTerm &subterm : term.subTerms()) {
for (const Akonadi::SearchTerm &subterm : subTerms) {
const Term newTerm = recursiveCalendarTermMapping(subterm);
if (newTerm.isValid()) {
t.addSubTerm(newTerm);
......@@ -223,9 +224,10 @@ Term recursiveCalendarTermMapping(const Akonadi::SearchTerm &term)
Term recursiveNoteTermMapping(const Akonadi::SearchTerm &term)
{
if (!term.subTerms().isEmpty()) {
const auto subTerms{term.subTerms()};
if (!subTerms.isEmpty()) {
Term t(mapRelation(term.relation()));
for (const Akonadi::SearchTerm &subterm : term.subTerms()) {
for (const Akonadi::SearchTerm &subterm : subTerms) {
const Term newTerm = recursiveNoteTermMapping(subterm);
if (newTerm.isValid()) {
t.addSubTerm(newTerm);
......@@ -251,9 +253,10 @@ Term recursiveNoteTermMapping(const Akonadi::SearchTerm &term)
Term recursiveContactTermMapping(const Akonadi::SearchTerm &term)
{
if (!term.subTerms().isEmpty()) {
const auto subTerms{term.subTerms()};
if (!subTerms.isEmpty()) {
Term t(mapRelation(term.relation()));
for (const Akonadi::SearchTerm &subterm : term.subTerms()) {
for (const Akonadi::SearchTerm &subterm : subTerms) {
const Term newTerm = recursiveContactTermMapping(subterm);
if (newTerm.isValid()) {
t.addSubTerm(newTerm);
......
......@@ -204,7 +204,8 @@ ResultIterator Query::exec()
SearchStore *storeMatch = nullptr;
for (const QSharedPointer<SearchStore> &store : std::as_const(*s_searchStores)) {
bool matches = true;
for (const QString &type : types()) {
const auto typeList{types()};
for (const QString &type : typeList) {
if (!store->types().contains(type)) {
matches = false;
break;
......
......@@ -126,9 +126,9 @@ public:
void addCustomOption(const QString &option, const QVariant &value);
void removeCustomOption(const QString &option);
QVariant customOption(const QString &option) const;
QVariantMap customOptions() const;
Q_REQUIRED_RESULT QVariantMap customOptions() const;
ResultIterator exec();
Q_REQUIRED_RESULT ResultIterator exec();
Q_REQUIRED_RESULT QByteArray toJSON() const;
static Query fromJSON(const QByteArray &arr);
......
......@@ -78,7 +78,7 @@ SearchStore::List SearchStore::searchStores()
const QStringList paths = QCoreApplication::libraryPaths();
for (const QString &libraryPath : paths) {
QString path(libraryPath + QStringLiteral("/akonadi"));
const QString path(libraryPath + QStringLiteral("/akonadi"));
QDir dir(path);
if (!dir.exists()) {
......
......@@ -301,10 +301,10 @@ Term Term::fromVariantMap(const QVariantMap &map)
Term term;
QString andOrString;
if (map.contains(QLatin1String("$and"))) {
if (map.contains(QStringLiteral("$and"))) {
andOrString = QStringLiteral("$and");
term.setOperation(And);
} else if (map.contains(QLatin1String("$or"))) {
} else if (map.contains(QStringLiteral("$or"))) {
andOrString = QStringLiteral("$or");
term.setOperation(Or);
}
......
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