reader: reduce variable scope

This commit is contained in:
Johannes Altmanninger
2026-04-30 13:32:18 +08:00
parent 4aadeea184
commit 8328e53050

View File

@@ -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