diff --git a/Cargo.lock b/Cargo.lock index 5b751e7fd..e579a5f0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3088,7 +3088,6 @@ dependencies = [ "num-bigint 0.3.1", "num-format", "num-traits 0.2.14", - "parking_lot 0.11.1", "query_interface", "serde 1.0.123", "toml", diff --git a/crates/nu-data/Cargo.toml b/crates/nu-data/Cargo.toml index e4e8abab8..3183bb3f8 100644 --- a/crates/nu-data/Cargo.toml +++ b/crates/nu-data/Cargo.toml @@ -23,7 +23,6 @@ log = "0.4.14" num-bigint = { version = "0.3.1", features = ["serde"] } num-format = "0.4.0" num-traits = "0.2.14" -parking_lot = "0.11.1" query_interface = "0.3.5" serde = { version = "1.0.123", features = ["derive"] } toml = "0.5.8" diff --git a/crates/nu-engine/src/evaluate/scope.rs b/crates/nu-engine/src/evaluate/scope.rs index c5a9fd380..63f56e9de 100644 --- a/crates/nu-engine/src/evaluate/scope.rs +++ b/crates/nu-engine/src/evaluate/scope.rs @@ -296,86 +296,3 @@ impl ScopeFrame { } } } - -// impl Scope { -// pub fn vars(&self) -> IndexMap { -// //FIXME: should this be an iterator? - -// let mut output = IndexMap::new(); - -// for v in &self.vars { -// output.insert(v.0.clone(), v.1.clone()); -// } - -// if let Some(parent) = &self.parent { -// for v in parent.vars() { -// if !output.contains_key(&v.0) { -// output.insert(v.0.clone(), v.1.clone()); -// } -// } -// } - -// output -// } - -// pub fn env(&self) -> IndexMap { -// //FIXME: should this be an iterator? - -// let mut output = IndexMap::new(); - -// for v in &self.env { -// output.insert(v.0.clone(), v.1.clone()); -// } - -// if let Some(parent) = &self.parent { -// for v in parent.env() { -// if !output.contains_key(&v.0) { -// output.insert(v.0.clone(), v.1.clone()); -// } -// } -// } - -// output -// } - -// pub fn var(&self, name: &str) -> Option { -// if let Some(value) = self.vars().get(name) { -// Some(value.clone()) -// } else { -// None -// } -// } - -// pub fn append_var(this: Arc, name: impl Into, value: Value) -> Arc { -// let mut vars = IndexMap::new(); -// vars.insert(name.into(), value); -// Arc::new(Scope { -// vars, -// env: IndexMap::new(), -// commands: IndexMap::new(), -// aliases: IndexMap::new(), -// parent: Some(this), -// }) -// } - -// pub fn append_vars(this: Arc, vars: IndexMap) -> Arc { -// Arc::new(Scope { -// vars, -// env: IndexMap::new(), -// commands: IndexMap::new(), -// aliases: IndexMap::new(), -// parent: Some(this), -// }) -// } - -// pub fn append_env(this: Arc, env: IndexMap) -> Arc { -// Arc::new(Scope { -// vars: IndexMap::new(), -// env, -// commands: IndexMap::new(), -// aliases: IndexMap::new(), -// parent: Some(this), -// }) -// } - -// } diff --git a/crates/nu-parser/src/parse.rs b/crates/nu-parser/src/parse.rs index 35e77987f..c0a048b98 100644 --- a/crates/nu-parser/src/parse.rs +++ b/crates/nu-parser/src/parse.rs @@ -938,107 +938,6 @@ fn parse_arg( } } -/* -#[cfg(test)] -mod test { - use super::*; - - #[derive(Clone, Debug)] - struct MockRegistry {} - - impl MockRegistry { - fn new() -> Self { - MockRegistry {} - } - } - - impl SignatureRegistry for MockRegistry { - fn has(&self, _name: &str) -> bool { - false - } - - fn get(&self, _name: &str) -> Option { - None - } - - fn clone_box(&self) -> Box { - Box::new(self.clone()) - } - } - - /* - #[test] - fn parse_integer() -> Result<(), ParseError> { - let raw = "32".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let scope = MockRegistry::new(); - let result = parse_arg(SyntaxShape::Int, &scope, &input); - assert_eq!(result.1, None); - assert_eq!(result.0.expr, Expression::integer(BigInt::from(32))); - Ok(()) - } - - #[test] - fn parse_number() -> Result<(), ParseError> { - let scope = MockRegistry::new(); - - let raw = "-32.2".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let result = parse_arg(SyntaxShape::Number, &scope, &input); - assert_eq!(result.1, None); - assert_eq!( - result.0.expr, - Expression::decimal(BigDecimal::new(BigInt::from(-322), 1)) - ); - - let raw = "32.2".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let result = parse_arg(SyntaxShape::Number, &scope, &input); - assert_eq!(result.1, None); - assert_eq!( - result.0.expr, - Expression::decimal(BigDecimal::new(BigInt::from(322), 1)) - ); - - let raw = "36893488147419103232.54".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let result = parse_arg(SyntaxShape::Number, &scope, &input); - assert_eq!(result.1, None); - assert_eq!( - result.0.expr, - Expression::decimal(BigDecimal::new( - BigInt::from(3689348814741910323254 as i128), - 2 - )) - ); - - let raw = "-34".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let result = parse_arg(SyntaxShape::Number, &scope, &input); - assert_eq!(result.1, None); - assert_eq!(result.0.expr, Expression::integer(BigInt::from(-34))); - - let raw = "34".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let result = parse_arg(SyntaxShape::Number, &scope, &input); - assert_eq!(result.1, None); - assert_eq!(result.0.expr, Expression::integer(BigInt::from(34))); - - let raw = "36893488147419103232".to_string(); - let input = raw.clone().spanned(Span::new(0, raw.len())); - let result = parse_arg(SyntaxShape::Number, &scope, &input); - assert_eq!(result.1, None); - assert_eq!( - result.0.expr, - Expression::integer(BigInt::from(36893488147419103232 as u128)) - ); - - Ok(()) - } - */ -} -*/ - /// Match the available flags in a signature with what the user provided. This will check both long-form flags (--long) and shorthand flags (-l) /// This also allows users to provide a group of shorthand flags (-la) that correspond to multiple shorthand flags at once. fn get_flags_from_flag(