mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
Remove unnecessary boxing of Stack::recursion_count
(#11238)
This commit is contained in:
parent
858c93d2e5
commit
51bf8d9f6a
@ -611,14 +611,14 @@ pub fn eval_block(
|
||||
// picked 50 arbitrarily, should work on all architectures
|
||||
const RECURSION_LIMIT: u64 = 50;
|
||||
if recursive {
|
||||
if *stack.recursion_count >= RECURSION_LIMIT {
|
||||
stack.recursion_count = Box::new(0);
|
||||
if stack.recursion_count >= RECURSION_LIMIT {
|
||||
stack.recursion_count = 0;
|
||||
return Err(ShellError::RecursionLimitReached {
|
||||
recursion_limit: RECURSION_LIMIT,
|
||||
span: block.span,
|
||||
});
|
||||
}
|
||||
*stack.recursion_count += 1;
|
||||
stack.recursion_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ pub struct Stack {
|
||||
pub env_hidden: HashMap<String, HashSet<String>>,
|
||||
/// List of active overlays
|
||||
pub active_overlays: Vec<String>,
|
||||
pub recursion_count: Box<u64>,
|
||||
pub recursion_count: u64,
|
||||
}
|
||||
|
||||
impl Stack {
|
||||
@ -45,7 +45,7 @@ impl Stack {
|
||||
env_vars: vec![],
|
||||
env_hidden: HashMap::new(),
|
||||
active_overlays: vec![DEFAULT_OVERLAY_NAME.to_string()],
|
||||
recursion_count: Box::new(0),
|
||||
recursion_count: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ impl Stack {
|
||||
env_vars,
|
||||
env_hidden: self.env_hidden.clone(),
|
||||
active_overlays: self.active_overlays.clone(),
|
||||
recursion_count: self.recursion_count.to_owned(),
|
||||
recursion_count: self.recursion_count,
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ impl Stack {
|
||||
env_vars,
|
||||
env_hidden: self.env_hidden.clone(),
|
||||
active_overlays: self.active_overlays.clone(),
|
||||
recursion_count: self.recursion_count.to_owned(),
|
||||
recursion_count: self.recursion_count,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user