diff --git a/src/arch.rs b/src/arch.rs index 82bda1b66..88985a6d7 100644 --- a/src/arch.rs +++ b/src/arch.rs @@ -25,7 +25,7 @@ pub fn get_safe_arch<'a>(arch: &'a Arch, version: &Version) -> &'a Arch { #[cfg(windows)] /// handle common case: Apple Silicon / Node < 16 pub fn get_safe_arch<'a>(arch: &'a Arch, _version: &Version) -> &'a Arch { - return &arch; + arch } impl Default for Arch { diff --git a/src/commands/env.rs b/src/commands/env.rs index fc82a9e00..f8f8655bf 100644 --- a/src/commands/env.rs +++ b/src/commands/env.rs @@ -64,17 +64,16 @@ impl Command for Env { } let multishell_path = make_symlink(config)?; + let multishell_path_str = multishell_path.to_str().unwrap().to_owned(); + let binary_path = if cfg!(windows) { - multishell_path.clone() + multishell_path } else { multishell_path.join("bin") }; let env_vars = HashMap::from([ - ( - "FNM_MULTISHELL_PATH", - multishell_path.to_str().unwrap().to_owned(), - ), + ("FNM_MULTISHELL_PATH", multishell_path_str), ( "FNM_VERSION_FILE_STRATEGY", config.version_file_strategy().as_str().to_owned(), diff --git a/src/version_file_strategy.rs b/src/version_file_strategy.rs index 89005be45..f55f10f44 100644 --- a/src/version_file_strategy.rs +++ b/src/version_file_strategy.rs @@ -1,7 +1,8 @@ use std::str::FromStr; -#[derive(Debug)] +#[derive(Debug, Default)] pub enum VersionFileStrategy { + #[default] Local, Recursive, } @@ -19,12 +20,6 @@ impl VersionFileStrategy { } } -impl Default for VersionFileStrategy { - fn default() -> Self { - VersionFileStrategy::Local - } -} - impl FromStr for VersionFileStrategy { type Err = String; @@ -33,8 +28,7 @@ impl FromStr for VersionFileStrategy { "local" => Ok(VersionFileStrategy::Local), "recursive" => Ok(VersionFileStrategy::Recursive), _ => Err(format!( - "Invalid strategy: {}. Expected one of: local, recursive", - s + "Invalid strategy: {s}. Expected one of: local, recursive" )), } }