From 4609d1ae0d552b509393dd0ecd972c83b2e204b0 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 4 May 2024 17:49:17 +0800 Subject: [PATCH] Apply Clippy suggestions --- src/cli/download_tracker.rs | 2 +- src/cli/rustup_mode.rs | 4 ++-- tests/suite/cli_rustup.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli/download_tracker.rs b/src/cli/download_tracker.rs index 0c5023fc2f6..1bd3b208b31 100644 --- a/src/cli/download_tracker.rs +++ b/src/cli/download_tracker.rs @@ -181,7 +181,7 @@ impl DownloadTracker { let percent = (self.total_downloaded as f64 / content_len as f64) * 100.; let remaining = content_len - self.total_downloaded; let eta_h = Duration::from_secs(if speed == 0 { - std::u64::MAX + u64::MAX } else { (remaining / speed) as u64 }); diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 3a7b4573627..2b7ee8fe31a 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -1176,7 +1176,7 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { )?; writeln!(t.lock(), "name: {}", active_toolchain.name())?; writeln!(t.lock(), "compiler: {}", active_toolchain.rustc_version())?; - writeln!(t.lock(), "active because: {}", active_reason.to_string())?; + writeln!(t.lock(), "active because: {}", active_reason)?; // show installed targets for the active toolchain writeln!(t.lock(), "installed targets:")?; @@ -1214,7 +1214,7 @@ fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result { let cwd = utils::current_dir()?; match cfg.find_active_toolchain(&cwd)? { Some((toolchain_name, reason)) => { - let toolchain = new_toolchain_with_reason(cfg, toolchain_name.clone().into(), &reason)?; + let toolchain = new_toolchain_with_reason(cfg, toolchain_name.clone(), &reason)?; writeln!( process().stdout().lock(), "{}\nactive because: {}", diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 833ee1544f9..89d4f85a9fb 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -2158,7 +2158,7 @@ fn override_order() { // env > dir override > file > default let out = config.run( "rustup", - &["show", "active-toolchain"], + ["show", "active-toolchain"], &[("RUSTUP_TOOLCHAIN", env_tc)], ); assert!(out.ok); @@ -2167,7 +2167,7 @@ fn override_order() { // +toolchain > env > dir override > file > default let out = config.run( "rustup", - &[&format!("+{}", command_tc), "show", "active-toolchain"], + [&format!("+{}", command_tc), "show", "active-toolchain"], &[("RUSTUP_TOOLCHAIN", env_tc)], ); assert!(out.ok);