From f0eaa516c05cdbba796879657acb992071e4479e Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 18 Nov 2023 12:44:21 -0800 Subject: [PATCH] Stop boxing ParseExecutionContext This wasn't necessary - probably a holdover from using unique_ptr in C++. --- fish-rust/src/parse_execution.rs | 2 +- fish-rust/src/parser.rs | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fish-rust/src/parse_execution.rs b/fish-rust/src/parse_execution.rs index 3f5cac6f4..f75a53e4b 100644 --- a/fish-rust/src/parse_execution.rs +++ b/fish-rust/src/parse_execution.rs @@ -101,7 +101,7 @@ struct CachedLineno { } impl ParseExecutionContext { - pub fn swap(left: &Self, right: Box) -> Box { + pub fn swap(left: &Self, right: Self) -> Self { left.pstree.swap(&right.pstree); left.cancel_signal.swap(&right.cancel_signal); left.executing_job_node.swap(&right.executing_job_node); diff --git a/fish-rust/src/parser.rs b/fish-rust/src/parser.rs index 78047dec0..57dac2bba 100644 --- a/fish-rust/src/parser.rs +++ b/fish-rust/src/parser.rs @@ -308,7 +308,7 @@ pub struct Parser { base: SharedFromThisBase, /// The current execution context. - execution_context: RefCell>>, + execution_context: RefCell>, /// The jobs associated with this parser. job_list: RefCell, @@ -381,7 +381,7 @@ pub fn new(variables: EnvStackRef, is_principal: bool) -> ParserRef { result } - fn execution_context(&self) -> Ref<'_, Option>> { + fn execution_context(&self) -> Ref<'_, Option> { self.execution_context.borrow() } @@ -579,10 +579,7 @@ pub fn eval_node( )) } }, - Some(Box::new(ParseExecutionContext::new( - ps.clone(), - block_io.clone(), - ))), + Some(ParseExecutionContext::new(ps.clone(), block_io.clone())), ); // Check the exec count so we know if anything got executed.