diff --git a/crates/nu-command/src/filesystem/rm.rs b/crates/nu-command/src/filesystem/rm.rs index 3e75cb84c0..aa3bdea46c 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 71c5e19f84..b6668aba4e 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,