From 33ad2a36bd86d0cd5cf7104fca95e4ec651f31bb Mon Sep 17 00:00:00 2001 From: Anas Alkhatib Date: Thu, 15 Jun 2023 01:30:54 -0400 Subject: [PATCH] Fix clippy errors (Mac) (#9440) # Description Was getting errors when running the clip checks on another PR. Applied the suggested fixes. image image --- crates/nu-command/src/filesystem/rm.rs | 2 +- crates/nu-parser/src/parse_keywords.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/nu-command/src/filesystem/rm.rs b/crates/nu-command/src/filesystem/rm.rs index 3e75cb84c..aa3bdea46 100644 --- a/crates/nu-command/src/filesystem/rm.rs +++ b/crates/nu-command/src/filesystem/rm.rs @@ -251,7 +251,7 @@ fn rm( for target in targets { if currentdir_path.to_string_lossy() == target.item - || currentdir_path.starts_with(&format!("{}{}", target.item, std::path::MAIN_SEPARATOR)) + || currentdir_path.starts_with(format!("{}{}", target.item, std::path::MAIN_SEPARATOR)) { return Err(ShellError::GenericError( "Cannot remove any parent directory".into(), diff --git a/crates/nu-parser/src/parse_keywords.rs b/crates/nu-parser/src/parse_keywords.rs index 71c5e19f8..b6668aba4 100644 --- a/crates/nu-parser/src/parse_keywords.rs +++ b/crates/nu-parser/src/parse_keywords.rs @@ -2637,7 +2637,7 @@ pub fn parse_overlay_use(working_set: &mut StateWorkingSet, call: Box) -> ( new_name .map(|spanned| spanned.item) - .unwrap_or(String::from_utf8_lossy(&new_module.name).to_string()), + .unwrap_or_else(|| String::from_utf8_lossy(&new_module.name).to_string()), new_module, module_id, true,