Browse Source

fix clippy (#972)

* fix clippy

* cargo fmt
remotes/origin/list-filter
Gal Schlezinger 2 years ago committed by GitHub
parent
commit
9940513c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/arch.rs
  2. 9
      src/commands/env.rs
  3. 12
      src/version_file_strategy.rs

2
src/arch.rs

@ -25,7 +25,7 @@ pub fn get_safe_arch<'a>(arch: &'a Arch, version: &Version) -> &'a Arch {
#[cfg(windows)] #[cfg(windows)]
/// handle common case: Apple Silicon / Node < 16 /// handle common case: Apple Silicon / Node < 16
pub fn get_safe_arch<'a>(arch: &'a Arch, _version: &Version) -> &'a Arch { pub fn get_safe_arch<'a>(arch: &'a Arch, _version: &Version) -> &'a Arch {
return &arch; arch
} }
impl Default for Arch { impl Default for Arch {

9
src/commands/env.rs

@ -64,17 +64,16 @@ impl Command for Env {
} }
let multishell_path = make_symlink(config)?; let multishell_path = make_symlink(config)?;
let multishell_path_str = multishell_path.to_str().unwrap().to_owned();
let binary_path = if cfg!(windows) { let binary_path = if cfg!(windows) {
multishell_path.clone() multishell_path
} else { } else {
multishell_path.join("bin") multishell_path.join("bin")
}; };
let env_vars = HashMap::from([ let env_vars = HashMap::from([
( ("FNM_MULTISHELL_PATH", multishell_path_str),
"FNM_MULTISHELL_PATH",
multishell_path.to_str().unwrap().to_owned(),
),
( (
"FNM_VERSION_FILE_STRATEGY", "FNM_VERSION_FILE_STRATEGY",
config.version_file_strategy().as_str().to_owned(), config.version_file_strategy().as_str().to_owned(),

12
src/version_file_strategy.rs

@ -1,7 +1,8 @@
use std::str::FromStr; use std::str::FromStr;
#[derive(Debug)] #[derive(Debug, Default)]
pub enum VersionFileStrategy { pub enum VersionFileStrategy {
#[default]
Local, Local,
Recursive, Recursive,
} }
@ -19,12 +20,6 @@ impl VersionFileStrategy {
} }
} }
impl Default for VersionFileStrategy {
fn default() -> Self {
VersionFileStrategy::Local
}
}
impl FromStr for VersionFileStrategy { impl FromStr for VersionFileStrategy {
type Err = String; type Err = String;
@ -33,8 +28,7 @@ impl FromStr for VersionFileStrategy {
"local" => Ok(VersionFileStrategy::Local), "local" => Ok(VersionFileStrategy::Local),
"recursive" => Ok(VersionFileStrategy::Recursive), "recursive" => Ok(VersionFileStrategy::Recursive),
_ => Err(format!( _ => Err(format!(
"Invalid strategy: {}. Expected one of: local, recursive", "Invalid strategy: {s}. Expected one of: local, recursive"
s
)), )),
} }
} }

Loading…
Cancel
Save