From 3ef047f242477b5b71382b559dcb58267ba6686c Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 16 Sep 2022 21:34:10 -0500 Subject: [PATCH] Remove needless rank comparison We've already removed any ranks that aren't equal to `best_rank` at this point, so why are we comparing them again? --- src/complete.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/complete.cpp b/src/complete.cpp index acc3dec78..85d3cba2f 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -303,9 +303,7 @@ void completions_sort_and_prioritize(completion_list_t *comps, completion_reques // Sort, provided COMPLETE_DONT_SORT isn't set. // Here we do not pass suppress_exact, so that exact matches appear first. - stable_sort(comps->begin(), comps->end(), [&](const completion_t &a, const completion_t &b) { - return a.rank() < b.rank() || natural_compare_completions(a, b); - }); + stable_sort(comps->begin(), comps->end(), natural_compare_completions); // Lastly, if this is for an autosuggestion, prefer to avoid completions that duplicate // arguments, and penalize files that end in tilde - they're frequently autosave files from e.g.