forked from extern/nushell
Remove parking_lot crate reference from nu-data (#3091)
* remove parking_lot crate from nu-data as it is no longer being used * remove commented out code from parse.rs * remove commented out code from scope.rs
This commit is contained in:
parent
2c89a228d5
commit
e834e617f3
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3088,7 +3088,6 @@ dependencies = [
|
|||||||
"num-bigint 0.3.1",
|
"num-bigint 0.3.1",
|
||||||
"num-format",
|
"num-format",
|
||||||
"num-traits 0.2.14",
|
"num-traits 0.2.14",
|
||||||
"parking_lot 0.11.1",
|
|
||||||
"query_interface",
|
"query_interface",
|
||||||
"serde 1.0.123",
|
"serde 1.0.123",
|
||||||
"toml",
|
"toml",
|
||||||
|
@ -23,7 +23,6 @@ log = "0.4.14"
|
|||||||
num-bigint = { version = "0.3.1", features = ["serde"] }
|
num-bigint = { version = "0.3.1", features = ["serde"] }
|
||||||
num-format = "0.4.0"
|
num-format = "0.4.0"
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
parking_lot = "0.11.1"
|
|
||||||
query_interface = "0.3.5"
|
query_interface = "0.3.5"
|
||||||
serde = { version = "1.0.123", features = ["derive"] }
|
serde = { version = "1.0.123", features = ["derive"] }
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
|
@ -296,86 +296,3 @@ impl ScopeFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Scope {
|
|
||||||
// pub fn vars(&self) -> IndexMap<String, Value> {
|
|
||||||
// //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<String, String> {
|
|
||||||
// //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<Value> {
|
|
||||||
// if let Some(value) = self.vars().get(name) {
|
|
||||||
// Some(value.clone())
|
|
||||||
// } else {
|
|
||||||
// None
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn append_var(this: Arc<Self>, name: impl Into<String>, value: Value) -> Arc<Scope> {
|
|
||||||
// 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<Self>, vars: IndexMap<String, Value>) -> Arc<Scope> {
|
|
||||||
// Arc::new(Scope {
|
|
||||||
// vars,
|
|
||||||
// env: IndexMap::new(),
|
|
||||||
// commands: IndexMap::new(),
|
|
||||||
// aliases: IndexMap::new(),
|
|
||||||
// parent: Some(this),
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn append_env(this: Arc<Self>, env: IndexMap<String, String>) -> Arc<Scope> {
|
|
||||||
// Arc::new(Scope {
|
|
||||||
// vars: IndexMap::new(),
|
|
||||||
// env,
|
|
||||||
// commands: IndexMap::new(),
|
|
||||||
// aliases: IndexMap::new(),
|
|
||||||
// parent: Some(this),
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
@ -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<nu_protocol::Signature> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn clone_box(&self) -> Box<dyn SignatureRegistry> {
|
|
||||||
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)
|
/// 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.
|
/// 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(
|
fn get_flags_from_flag(
|
||||||
|
Loading…
Reference in New Issue
Block a user