mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-21 10:36:49 +00:00
[clangd] Simplify ternary expressions with std::optional::value_or (NFC) (#111309)
This commit is contained in:
parent
7f65377880
commit
b0c070e263
clang-tools-extra/clangd
@ -111,7 +111,7 @@ getWorkspaceSymbols(llvm::StringRef Query, int Limit,
|
||||
*Req.Limit *= 5;
|
||||
}
|
||||
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);
|
||||
|
||||
Index->fuzzyFind(Req, [HintPath, &Top, &Filter, AnyScope = Req.AnyScope,
|
||||
|
@ -31,7 +31,7 @@ bool MemIndex::fuzzyFind(
|
||||
trace::Span Tracer("MemIndex fuzzyFind");
|
||||
|
||||
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);
|
||||
bool More = false;
|
||||
for (const auto &Pair : Index) {
|
||||
|
@ -264,7 +264,7 @@ bool Dex::fuzzyFind(const FuzzyFindRequest &Req,
|
||||
return LHS.second > RHS.second;
|
||||
};
|
||||
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) {
|
||||
const DocID SymbolDocID = IDAndScore.first;
|
||||
const auto *Sym = Symbols[SymbolDocID];
|
||||
|
Loading…
x
Reference in New Issue
Block a user