diff --git a/src/reader/reader.rs b/src/reader/reader.rs index 94bce010a..612afd28c 100644 --- a/src/reader/reader.rs +++ b/src/reader/reader.rs @@ -6698,7 +6698,6 @@ fn best>( // Decide which completions survived. There may be a lot of them; it would be nice if we could // figure out how to avoid copying them here. let mut surviving_completions = vec![]; - let mut all_matches_exact_or_prefix = true; for c in best(best_rank, comp.into_iter()) { // Only use completions that match replace_token. let completion_replaces_token = c.replaces_token(); @@ -6719,8 +6718,6 @@ fn best>( continue; } - all_matches_exact_or_prefix &= c.r#match.is_exact_or_prefix(); - let mut c = c; if replaces_only_due_to_case_mismatch && !will_replace_token { c.flags |= CompleteFlags::SUPPRESS_PAGER_PREFIX; @@ -6743,6 +6740,10 @@ fn best>( let mut use_prefix = false; let mut common_prefix = L!(""); + let all_matches_exact_or_prefix = surviving_completions + .iter() + .all(|c| c.r#match.is_exact_or_prefix()); + assert!(will_replace_token || all_matches_exact_or_prefix); if all_matches_exact_or_prefix { // Try to find a common prefix to insert among the surviving completions. let mut flags = CompleteFlags::empty(); @@ -6802,7 +6803,6 @@ fn best>( // Print the completion list. let mut prefix = WString::new(); - assert!(will_replace_token || all_matches_exact_or_prefix); if will_replace_token { if use_prefix { prefix.push_utfstr(&common_prefix);