[clangd] Simplify ternary expressions with std::optional::value_or (NFC) (#111309)
This commit is contained in:
@@ -111,7 +111,7 @@ getWorkspaceSymbols(llvm::StringRef Query, int Limit,
|
|||||||
*Req.Limit *= 5;
|
*Req.Limit *= 5;
|
||||||
}
|
}
|
||||||
TopN<ScoredSymbolInfo, ScoredSymbolGreater> Top(
|
TopN<ScoredSymbolInfo, ScoredSymbolGreater> Top(
|
||||||
Req.Limit ? *Req.Limit : std::numeric_limits<size_t>::max());
|
Req.Limit.value_or(std::numeric_limits<size_t>::max()));
|
||||||
FuzzyMatcher Filter(Req.Query);
|
FuzzyMatcher Filter(Req.Query);
|
||||||
|
|
||||||
Index->fuzzyFind(Req, [HintPath, &Top, &Filter, AnyScope = Req.AnyScope,
|
Index->fuzzyFind(Req, [HintPath, &Top, &Filter, AnyScope = Req.AnyScope,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ bool MemIndex::fuzzyFind(
|
|||||||
trace::Span Tracer("MemIndex fuzzyFind");
|
trace::Span Tracer("MemIndex fuzzyFind");
|
||||||
|
|
||||||
TopN<std::pair<float, const Symbol *>> Top(
|
TopN<std::pair<float, const Symbol *>> Top(
|
||||||
Req.Limit ? *Req.Limit : std::numeric_limits<size_t>::max());
|
Req.Limit.value_or(std::numeric_limits<size_t>::max()));
|
||||||
FuzzyMatcher Filter(Req.Query);
|
FuzzyMatcher Filter(Req.Query);
|
||||||
bool More = false;
|
bool More = false;
|
||||||
for (const auto &Pair : Index) {
|
for (const auto &Pair : Index) {
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest &Req,
|
|||||||
return LHS.second > RHS.second;
|
return LHS.second > RHS.second;
|
||||||
};
|
};
|
||||||
TopN<IDAndScore, decltype(Compare)> Top(
|
TopN<IDAndScore, decltype(Compare)> Top(
|
||||||
Req.Limit ? *Req.Limit : std::numeric_limits<size_t>::max(), Compare);
|
Req.Limit.value_or(std::numeric_limits<size_t>::max()), Compare);
|
||||||
for (const auto &IDAndScore : IDAndScores) {
|
for (const auto &IDAndScore : IDAndScores) {
|
||||||
const DocID SymbolDocID = IDAndScore.first;
|
const DocID SymbolDocID = IDAndScore.first;
|
||||||
const auto *Sym = Symbols[SymbolDocID];
|
const auto *Sym = Symbols[SymbolDocID];
|
||||||
|
|||||||
Reference in New Issue
Block a user