Skip to content

Commit fc40fee

Browse files
committed
lint errors
1 parent 97868d7 commit fc40fee

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/core/fzy.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#include "fzy.h"
22
#include <algorithm>
33
#include <array>
4-
#include <bitset>
5-
6-
#include <QVariant>
4+
#include <cmath>
5+
#include <limits>
6+
7+
#include <qnamespace.h>
8+
#include <qstring.h>
9+
#include <qstringview.h>
10+
#include <qtypes.h>
11+
#include <qvariant.h>
712
#include <span>
813

914
namespace {
@@ -90,7 +95,7 @@ void precomputeBonus(QStringView haystack, std::span<double> matchBonus) {
9095
/* Which positions are beginning of words */
9196
QChar lastCh = '/';
9297
for (qsizetype index = 0; index < haystack.size(); index++) {
93-
QChar ch = haystack[index];
98+
const QChar ch = haystack[index];
9499
matchBonus[index] = getBonus(lastCh, ch);
95100
lastCh = ch;
96101
}
@@ -119,15 +124,15 @@ void matchRow(
119124
std::span<const double> lastD,
120125
std::span<const double> lastM
121126
) {
122-
qsizetype needleLen = match.lowerNeedle.size();
123-
qsizetype haystackLen = match.lowerHaystack.size();
127+
const qsizetype needleLen = match.lowerNeedle.size();
128+
const qsizetype haystackLen = match.lowerHaystack.size();
124129

125-
QStringView lowerNeedle = match.lowerNeedle;
126-
QStringView lowerHaystack = match.lowerHaystack;
127-
std::span<const double> matchBonus = match.matchBonus;
130+
const QStringView lowerNeedle = match.lowerNeedle;
131+
const QStringView lowerHaystack = match.lowerHaystack;
132+
const std::span<const double> matchBonus = match.matchBonus;
128133

129134
double prevScore = SCORE_MIN;
130-
double gapScore = row == needleLen - 1 ? SCORE_GAP_TRAILING : SCORE_GAP_INNER;
135+
const double gapScore = row == needleLen - 1 ? SCORE_GAP_TRAILING : SCORE_GAP_INNER;
131136

132137
/* These will not be used with this value, but not all compilers see it */
133138
double prevM = SCORE_MIN;
@@ -168,7 +173,7 @@ double match(QStringView needle, QStringView haystack) {
168173
return SCORE_MAX;
169174
}
170175

171-
MatchStruct match = setupMatchStruct(needle, haystack);
176+
const MatchStruct match = setupMatchStruct(needle, haystack);
172177

173178
/*
174179
* D Stores the best score for this position ending with a match.
@@ -198,7 +203,7 @@ FzyFinder::filter(const QString& needle, const QList<QObject*>& haystacks, const
198203
}
199204
}
200205
std::ranges::stable_sort(list, std::ranges::greater(), &ScoredResult::score);
201-
auto out = QList<QObject*>(static_cast<qsizetype>(list.size()));
206+
auto out = QList<QObject*>(list.size());
202207
std::ranges::transform(list, out.begin(), [](const ScoredResult& result) -> QObject* {
203208
return result.obj;
204209
});

0 commit comments

Comments
 (0)