From ac36b4a24757b942cbdf666d4e4cbb21f614a9d0 Mon Sep 17 00:00:00 2001 From: Bahex <17417311+Bahex@users.noreply.github.com> Date: Tue, 6 May 2025 11:27:34 +0300 Subject: [PATCH] fix: Further limit expressions that are accepted as a closure - Only variables and cell-path accesses on variables are allowed as closures. These can't be `$it` or a path on `$it` - Any other expression falls back to the usual RowCondition expression --- crates/nu-parser/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 3f9d51fb68..71510466b6 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -3613,7 +3613,7 @@ pub fn parse_row_condition(working_set: &mut StateWorkingSet, spans: &[Span]) -> let block_id = match expression.expr { Expr::Block(block_id) => block_id, Expr::Closure(block_id) => block_id, - Expr::FullCellPath(ref box_fcp) if box_fcp.head.as_var() != Some(var_id) => { + Expr::FullCellPath(ref box_fcp) if box_fcp.head.as_var().is_some_and(|id| id != var_id) => { let mut expression = expression; expression.ty = Type::Any; return expression;