Remove the ParserRef type

No need to pass around Rc any more.
This commit is contained in:
Peter Ammon 2024-06-23 15:20:31 -07:00
parent 4557d9fc09
commit 6163999ec7
No known key found for this signature in database
2 changed files with 5 additions and 7 deletions

View File

@ -351,8 +351,6 @@ pub enum ParserStatusVar {
pub type BlockId = usize;
pub type ParserRef = Rc<Parser>;
// Controls the behavior when fish itself receives a signal and there are
// no blocks on the stack.
// The "outermost" parser is responsible for clearing the signal.
@ -404,8 +402,8 @@ pub struct Parser {
impl Parser {
/// Create a parser.
pub fn new(variables: Rc<EnvStack>, cancel_behavior: CancelBehavior) -> ParserRef {
let result = Rc::new(Self {
pub fn new(variables: Rc<EnvStack>, cancel_behavior: CancelBehavior) -> Parser {
let result = Self {
execution_context: RefCell::default(),
job_list: RefCell::default(),
wait_handles: RefCell::new(WaitHandleStore::new()),
@ -417,7 +415,7 @@ impl Parser {
cancel_behavior,
profile_items: RefCell::default(),
global_event_blocks: AtomicU64::new(0),
});
};
match open_dir(CStr::from_bytes_with_nul(b".\0").unwrap(), BEST_O_SEARCH) {
Ok(fd) => {

View File

@ -30,7 +30,7 @@ mod wgetopt;
pub mod prelude {
use crate::common::ScopeGuarding;
use crate::env::{env_init, misc_init};
use crate::parser::{CancelBehavior, Parser, ParserRef};
use crate::parser::{CancelBehavior, Parser};
use crate::reader::reader_init;
use crate::signal::signal_reset_handlers;
pub use crate::tests::env::{PwdEnvironment, TestEnvironment};
@ -45,7 +45,7 @@ pub mod prelude {
/// A wrapper around a Parser with some test helpers.
pub struct TestParser {
parser: ParserRef,
parser: Parser,
pushed_dirs: RefCell<Vec<String>>,
}