diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index dc1f2e8b6a..bc48b9bd0c 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -5659,9 +5659,9 @@ pub(crate) fn redirecting_builtin_error( } pub fn parse_pipeline(working_set: &mut StateWorkingSet, pipeline: &LitePipeline) -> Pipeline { - let first_command = pipeline.commands.get(0); + let first_command = pipeline.commands.first(); let first_command_name = first_command - .and_then(|command| command.parts.get(0)) + .and_then(|command| command.parts.first()) .map(|span| working_set.get_span_contents(*span)); if pipeline.commands.len() > 1 { @@ -5768,7 +5768,7 @@ pub fn parse_block( && block .pipelines .iter() - .flat_map(|pipeline| pipeline.elements.get(0)) + .flat_map(|pipeline| pipeline.elements.first()) .any(|element| element.has_in_variable(working_set)) { // Move the block out to prepare it to become a subexpression diff --git a/crates/nu-protocol/src/ast/expression.rs b/crates/nu-protocol/src/ast/expression.rs index bfa164ad2f..4818aa2db2 100644 --- a/crates/nu-protocol/src/ast/expression.rs +++ b/crates/nu-protocol/src/ast/expression.rs @@ -114,7 +114,7 @@ impl Expression { || block .pipelines .iter() - .flat_map(|pipeline| pipeline.elements.get(0)) + .flat_map(|pipeline| pipeline.elements.first()) .any(|element| element.has_in_variable(working_set)) } Expr::Binary(_) => false,