Skip to content

Commit

Permalink
fix clippy (#972)
Browse files Browse the repository at this point in the history
* fix clippy

* cargo fmt
  • Loading branch information
Schniz committed Jun 29, 2023
1 parent c80d8ca commit 9940513
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions src/commands/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
12 changes: 3 additions & 9 deletions src/version_file_strategy.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::str::FromStr;

#[derive(Debug)]
#[derive(Debug, Default)]
pub enum VersionFileStrategy {
#[default]
Local,
Recursive,
}
Expand All @@ -19,12 +20,6 @@ impl VersionFileStrategy {
}
}

impl Default for VersionFileStrategy {
fn default() -> Self {
VersionFileStrategy::Local
}
}

impl FromStr for VersionFileStrategy {
type Err = String;

Expand All @@ -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"
)),
}
}
Expand Down

1 comment on commit 9940513

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux Benchmarks

benchmark current value last value diff trend
fnm_basic/median 20.07ms 20.81ms -0.74ms

fnm_basic/max 23.09ms 22.75ms +0.34ms

fnm_basic/mean 20.2ms 20.96ms -0.76ms

fnm_basic/min 19.72ms 20.29ms -0.57ms

fnm_basic/stddev 0.43ms 0.53ms -0.1ms

binary size 6796kb 6772kb +24kb

Please sign in to comment.