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.
This commit is contained in:
ridiculousfish 2024-05-26 14:34:20 -07:00 committed by Peter Ammon
parent 245ee466cb
commit 832ed31687
No known key found for this signature in database

View file

@ -1868,7 +1868,7 @@ impl<'ctx> Completer<'ctx> {
fn apply_var_assignments<'a>(
&mut self,
var_assignments: impl IntoIterator<Item = &'a wstr>,
) -> Option<ScopeGuard<(), impl FnOnce(&mut ())>> {
) -> Option<ScopeGuard<(), impl FnOnce(&mut ()) + 'ctx>> {
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.