From 8328e530501a6a82e20b5d86e5ecda696b09ab51 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 30 Apr 2026 13:32:18 +0800 Subject: [PATCH] reader: reduce variable scope --- src/reader/reader.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/reader/reader.rs b/src/reader/reader.rs index 8fe963fe4..dfe596fba 100644 --- a/src/reader/reader.rs +++ b/src/reader/reader.rs @@ -6961,13 +6961,15 @@ fn compute_and_apply_completions(&mut self, c: ReadlineCmd) { // Construct a copy of the string from the beginning of the command substitution // up to the end of the token we're completing. - let cmdsub = &el.text()[cmdsub_range.start..token_range.end]; - let (mut comp, _needs_load) = complete( - cmdsub, - CompletionRequestOptions::normal(), - &self.parser.context(), - ); + let (mut comp, _needs_load) = { + let cmdsub = &el.text()[cmdsub_range.start..token_range.end]; + complete( + cmdsub, + CompletionRequestOptions::normal(), + &self.parser.context(), + ) + }; let el = &self.command_line; // User-supplied completions may have changed the commandline - prevent buffer