From c10e78283832111dbd57f79a14c6caa85bdb1571 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 2 Jun 2026 09:40:45 +0800 Subject: [PATCH] Remove unused allocation in complete_abbr argument Helps the next commit. --- src/complete.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/complete.rs b/src/complete.rs index 52bc0b0d3..e6f295eb9 100644 --- a/src/complete.rs +++ b/src/complete.rs @@ -689,7 +689,7 @@ fn perform_for_commandline_impl(&mut self, cmdline: WString) { return; } self.complete_cmd(WString::new()); - self.complete_abbr(WString::new()); + self.complete_abbr(L!("")); return; }; @@ -744,9 +744,8 @@ fn perform_for_commandline_impl(&mut self, cmdline: WString) { return; } // Complete command filename. - let current_token = current_token.to_owned(); - self.complete_abbr(current_token.clone()); - self.complete_cmd(current_token); + self.complete_abbr(current_token); + self.complete_cmd(current_token.to_owned()); return; } // See whether we are in an argument, in a redirection or in the whitespace in between. @@ -1146,7 +1145,7 @@ fn complete_cmd(&mut self, str_cmd: WString) { } /// Attempt to complete an abbreviation for the given string. - fn complete_abbr(&mut self, cmd: WString) { + fn complete_abbr(&mut self, cmd: &wstr) { // Copy the list of names and descriptions so as not to hold the lock across the call to // complete_strings. let mut possible_comp = Vec::new(); @@ -1165,7 +1164,7 @@ fn complete_abbr(&mut self, cmd: WString) { wgettext_fmt!(ABBR_DESC, replacement) }; self.complete_strings( - &cmd, + cmd, &{ Box::new(desc_func) as _ }, &possible_comp, CompleteFlags::NO_SPACE,