From 92dd37d3c7d264749219e47c3ee287ec357337cc Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 2 Jan 2026 08:24:00 +0100 Subject: [PATCH] reader handle_completions(): remove dead code for skipping to add prefix The tuple (will_replace_token, all_matches_exact_or_prefix) can never be (false, false). Proof by contraction: 1. Goal: show unsatisfiability of: !will_replace_token && !all_matches_exact_or_prefix 2. Substitute defintions: !all(replaces) && !all(is_exact_or_prefix) 3. wlog, !replaces(c1) && !is_exact_or_prefix(c2) 4. since c1 and c2 have same rank we know that !is_exact_or_prefix(c1) 5. !is_exact_or_prefix() implies requires_full_replacement() 6. all callers that create a Completion from StringFuzzyMatch::try_create(), set CompleteFlags::REPLACE_TOKEN if requires_full_replacement(), so requires_full_replacement() implies replaces() 7. From 4-6 follows: !is_exact_or_prefix(c1) implies replaces(c1), which is a contradiction --- src/reader/reader.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/reader/reader.rs b/src/reader/reader.rs index c3c9a4de3..f9292c33c 100644 --- a/src/reader/reader.rs +++ b/src/reader/reader.rs @@ -6808,7 +6808,8 @@ fn handle_completions(&mut self, token_range: Range, comp: Vec