From 832ed316879e9a80a77e4f3842dacff211d7d8e2 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 26 May 2024 14:34:20 -0700 Subject: [PATCH] Start removing calls to Parser::shared() Parser::shared() gets an Rc to a Parser, but we can do without it. Let's aim to get rid of the cyclic ref. --- src/complete.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/complete.rs b/src/complete.rs index 6a69e57ba..b8794cd71 100644 --- a/src/complete.rs +++ b/src/complete.rs @@ -1868,7 +1868,7 @@ impl<'ctx> Completer<'ctx> { fn apply_var_assignments<'a>( &mut self, var_assignments: impl IntoIterator, - ) -> Option> { + ) -> Option> { if !self.ctx.has_parser() { return None; } @@ -1923,8 +1923,8 @@ impl<'ctx> Completer<'ctx> { } } - let parser_ref = self.ctx.parser().shared(); - Some(ScopeGuard::new((), move |_| parser_ref.pop_block(block))) + let parser = self.ctx.parser(); + Some(ScopeGuard::new((), move |_| parser.pop_block(block))) } /// Complete a command by invoking user-specified completions.