From a84dc00c826f1db244f7b72142460975d3cde266 Mon Sep 17 00:00:00 2001 From: OpenByte Date: Fri, 9 Dec 2022 21:03:09 +0100 Subject: [PATCH] Fix clippy warnings --- burnt-sushi-blocker/Cargo.toml | 3 +-- burnt-sushi/build.rs | 4 ++-- burnt-sushi/src/logger/console.rs | 4 ++-- burnt-sushi/src/main.rs | 8 ++++---- burnt-sushi/src/update.rs | 6 ++---- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/burnt-sushi-blocker/Cargo.toml b/burnt-sushi-blocker/Cargo.toml index 252c1b8..39b0f8f 100644 --- a/burnt-sushi-blocker/Cargo.toml +++ b/burnt-sushi-blocker/Cargo.toml @@ -17,8 +17,7 @@ futures = { version = "0.3.25", default-features = false } tokio = { version = "1.23.0", features = ["net", "rt", "macros", "sync"], default-features = false } tokio-util = { version = "0.7.4", features = ["compat"], default-features = false } winapi = { version = "0.3.9", features = ["ws2tcpip", "rpc"], default-features = false } -# detour = { version = "0.8.1", features = ["nightly"], default-features = false } -detour = { git = "https://github.com/Hpmason/detour-rs.git", branch = "fix-nightly1.67.0-changes", commit = "0773585c9d4940fe6dd104076a46e8e11495080e", features = ["nightly"], default-features = false } +detour = { git = "https://github.com/Hpmason/detour-rs.git", branch = "fix-nightly1.67.0-changes", features = ["nightly"], default-features = false } shared = { path = "../shared", default-features = false } regex = { version = "1.7.0", default-features = false } enum-map = { version = "2.4.1", default-features = false } diff --git a/burnt-sushi/build.rs b/burnt-sushi/build.rs index 0e60be2..a00bbda 100644 --- a/burnt-sushi/build.rs +++ b/burnt-sushi/build.rs @@ -41,7 +41,7 @@ fn build_crate(name: &str, target: &str, file: &str) -> PathBuf { crate_dir.push(name); cargo_emit::rerun_if_changed!("..\\{}", name); - let mut command = Command::new(&cargo_exe); + let mut command = Command::new(cargo_exe); if cfg!(nightly) { command.arg("+nightly"); @@ -66,7 +66,7 @@ fn build_crate(name: &str, target: &str, file: &str) -> PathBuf { crate_artifact.push(if is_release { "release" } else { "debug" }); crate_artifact.push(file); - assert!(crate_artifact.exists(), "{:?}", crate_artifact); + assert!(crate_artifact.exists(), "{crate_artifact:?}"); crate_artifact } diff --git a/burnt-sushi/src/logger/console.rs b/burnt-sushi/src/logger/console.rs index b1c5f6b..66dd3bf 100644 --- a/burnt-sushi/src/logger/console.rs +++ b/burnt-sushi/src/logger/console.rs @@ -157,8 +157,8 @@ impl Console { pub fn println(&self, s: impl Display) -> io::Result<()> { match &self.0 { ConsoleImpl::None => {} - ConsoleImpl::Attach | ConsoleImpl::Alloc => println!("{}", s), - ConsoleImpl::Piped { pipe, .. } => writeln!(pipe.lock().unwrap(), "{}", s)?, + ConsoleImpl::Attach | ConsoleImpl::Alloc => println!("{s}"), + ConsoleImpl::Piped { pipe, .. } => writeln!(pipe.lock().unwrap(), "{s}")?, } Ok(()) } diff --git a/burnt-sushi/src/main.rs b/burnt-sushi/src/main.rs index 6cf8338..d3d2128 100644 --- a/burnt-sushi/src/main.rs +++ b/burnt-sushi/src/main.rs @@ -67,7 +67,7 @@ async fn main() { if ARGS.install { match handle_install().await { Ok(()) => info!("App successfully installed."), - Err(e) => error!("Failed to install application: {}", e), + Err(e) => error!("Failed to install application: {e}"), } return; } @@ -80,7 +80,7 @@ async fn main() { match terminate_other_instances() { Ok(_) => debug!("Killed previously running instances"), Err(err) => { - error!("Failed to open previously running instance (err={})", err); + error!("Failed to open previously running instance (err={err})"); return; } } @@ -89,7 +89,7 @@ async fn main() { if ARGS.ignore_singleton { run().await; } else { - let lock = NamedMutex::new(&format!("{} SINGLETON MUTEX", APP_NAME)).unwrap(); + let lock = NamedMutex::new(&format!("{APP_NAME} SINGLETON MUTEX")).unwrap(); let mut guard_result = lock.try_lock(); @@ -125,7 +125,7 @@ async fn run() { match update::update().await { Ok(true) => update_restart_tx.send(()).unwrap(), Ok(false) => {} - Err(e) => error!("App update failed: {:#}", e), + Err(e) => error!("App update failed: {e:#}"), } }); diff --git a/burnt-sushi/src/update.rs b/burnt-sushi/src/update.rs index 5b8f5ef..4c56d4c 100644 --- a/burnt-sushi/src/update.rs +++ b/burnt-sushi/src/update.rs @@ -7,7 +7,6 @@ use std::{ }; use anyhow::Context; -use lenient_semver; use log::{debug, error, info}; use reqwest::header::HeaderValue; use self_update::update::Release; @@ -68,8 +67,7 @@ pub async fn update() -> anyhow::Result { let asset = release .assets .into_iter() - .filter(|asset| asset.name.ends_with(".exe")) - .next() + .find(|asset| asset.name.ends_with(".exe")) .context("No release executable asset found")?; debug!( @@ -185,7 +183,7 @@ async fn confirm_update(version: &str) -> bool { let mut toast = Toast::new(); toast .text1("BurntSushi") - .text2(Text::new(format!("Update app to to {}?", version))) + .text2(Text::new(format!("Update app to to {version}?"))) .action(Action::new("Update", CONFIRM_ACTION, CONFIRM_ACTION)) .action(Action::new("Ignore", IGNORE_ACTION, IGNORE_ACTION));