diff --git a/crates/nu-command/src/each.rs b/crates/nu-command/src/each.rs index 6a96ec9e74..2ec432f0a6 100644 --- a/crates/nu-command/src/each.rs +++ b/crates/nu-command/src/each.rs @@ -1,7 +1,7 @@ -use nu_engine::{eval_block, eval_expression}; +use nu_engine::eval_block; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EvaluationContext}; -use nu_protocol::{IntoValueStream, Signature, Span, SyntaxShape, Value}; +use nu_protocol::{IntoValueStream, Signature, SyntaxShape, Value}; pub struct Each; diff --git a/crates/nu-command/src/for_.rs b/crates/nu-command/src/for_.rs index bdf882ac0a..c72d5b2147 100644 --- a/crates/nu-command/src/for_.rs +++ b/crates/nu-command/src/for_.rs @@ -1,7 +1,7 @@ use nu_engine::{eval_block, eval_expression}; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EvaluationContext}; -use nu_protocol::{IntoValueStream, Signature, Span, SyntaxShape, Value}; +use nu_protocol::{IntoValueStream, Signature, SyntaxShape, Value}; pub struct For; @@ -36,7 +36,7 @@ impl Command for For { &self, context: &EvaluationContext, call: &Call, - input: Value, + _input: Value, ) -> Result { let var_id = call.positional[0] .as_var() diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 0c1810c221..092335922a 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -595,11 +595,7 @@ pub fn parse_call( } } -pub fn parse_int( - working_set: &mut StateWorkingSet, - token: &str, - span: Span, -) -> (Expression, Option) { +pub fn parse_int(token: &str, span: Span) -> (Expression, Option) { if let Some(token) = token.strip_prefix("0x") { if let Ok(v) = i64::from_str_radix(token, 16) { ( @@ -677,11 +673,7 @@ pub fn parse_int( } } -pub fn parse_float( - working_set: &mut StateWorkingSet, - token: &str, - span: Span, -) -> (Expression, Option) { +pub fn parse_float(token: &str, span: Span) -> (Expression, Option) { if let Ok(x) = token.parse::() { ( Expression { @@ -699,14 +691,10 @@ pub fn parse_float( } } -pub fn parse_number( - working_set: &mut StateWorkingSet, - token: &str, - span: Span, -) -> (Expression, Option) { - if let (x, None) = parse_int(working_set, token, span) { +pub fn parse_number(token: &str, span: Span) -> (Expression, Option) { + if let (x, None) = parse_int(token, span) { (x, None) - } else if let (x, None) = parse_float(working_set, token, span) { + } else if let (x, None) = parse_float(token, span) { (x, None) } else { ( @@ -951,7 +939,7 @@ pub fn parse_full_column_path( let source = working_set.get_span_contents(span); - let (output, err) = lex(source, start, &[], &[]); + let (output, err) = lex(source, start, &[b'\n'], &[]); error = error.or(err); let (output, err) = lite_parse(&output); @@ -1717,7 +1705,7 @@ pub fn parse_value( match shape { SyntaxShape::Number => { if let Ok(token) = String::from_utf8(bytes.into()) { - parse_number(working_set, &token, span) + parse_number(&token, span) } else { ( garbage(span), @@ -1727,7 +1715,7 @@ pub fn parse_value( } SyntaxShape::Int => { if let Ok(token) = String::from_utf8(bytes.into()) { - parse_int(working_set, &token, span) + parse_int(&token, span) } else { ( garbage(span), diff --git a/crates/nu-parser/tests/test_parser.rs b/crates/nu-parser/tests/test_parser.rs index 0ffa726de1..a2f5fc2609 100644 --- a/crates/nu-parser/tests/test_parser.rs +++ b/crates/nu-parser/tests/test_parser.rs @@ -16,9 +16,7 @@ pub fn parse_int() { assert!(err.is_none()); assert!(block.len() == 1); match &block[0] { - Statement::Pipeline(Pipeline { - expressions: expressions, - }) => { + Statement::Pipeline(Pipeline { expressions }) => { assert!(expressions.len() == 1); assert!(matches!( expressions[0],