From 2c6b1471e1e44e7ddc4b230bb0b99aad0f8551e3 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Thu, 1 Aug 2024 11:02:55 +0200 Subject: [PATCH] Contentious clippy fixes (#13498) Lints from stable or nightly toolchain that may have questionable added value. - **Contentious lint to contract into single `if let`** - **Potential false positive around `AsRef`/`Deref` fun** --- crates/nu-command/src/filesystem/ucp.rs | 2 +- crates/nu-command/src/filesystem/umv.rs | 2 +- crates/nu-parser/src/parse_keywords.rs | 28 ++++++++++++------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/nu-command/src/filesystem/ucp.rs b/crates/nu-command/src/filesystem/ucp.rs index d73413d721..447751220d 100644 --- a/crates/nu-command/src/filesystem/ucp.rs +++ b/crates/nu-command/src/filesystem/ucp.rs @@ -235,7 +235,7 @@ impl Command for UCp { for (sources, need_expand_tilde) in sources.iter_mut() { for src in sources.iter_mut() { if !src.is_absolute() { - *src = nu_path::expand_path_with(&src, &cwd, *need_expand_tilde); + *src = nu_path::expand_path_with(&*src, &cwd, *need_expand_tilde); } } } diff --git a/crates/nu-command/src/filesystem/umv.rs b/crates/nu-command/src/filesystem/umv.rs index 0c10df9ab2..12d95e015b 100644 --- a/crates/nu-command/src/filesystem/umv.rs +++ b/crates/nu-command/src/filesystem/umv.rs @@ -156,7 +156,7 @@ impl Command for UMv { for (files, need_expand_tilde) in files.iter_mut() { for src in files.iter_mut() { if !src.is_absolute() { - *src = nu_path::expand_path_with(&src, &cwd, *need_expand_tilde); + *src = nu_path::expand_path_with(&*src, &cwd, *need_expand_tilde); } } } diff --git a/crates/nu-parser/src/parse_keywords.rs b/crates/nu-parser/src/parse_keywords.rs index 6b7245f1ce..b4506e7f7d 100644 --- a/crates/nu-parser/src/parse_keywords.rs +++ b/crates/nu-parser/src/parse_keywords.rs @@ -300,21 +300,21 @@ pub fn parse_for(working_set: &mut StateWorkingSet, lite_command: &LiteCommand) } // Let's get our block and make sure it has the right signature - if let Some(arg) = call.positional_nth(2) { - match arg { - Expression { - expr: Expr::Block(block_id), - .. - } - | Expression { - expr: Expr::RowCondition(block_id), - .. - } => { - let block = working_set.get_block_mut(*block_id); + if let Some( + Expression { + expr: Expr::Block(block_id), + .. + } + | Expression { + expr: Expr::RowCondition(block_id), + .. + }, + ) = call.positional_nth(2) + { + { + let block = working_set.get_block_mut(*block_id); - block.signature = Box::new(sig); - } - _ => {} + block.signature = Box::new(sig); } }