diff --git a/examples/example_fixture.rs b/examples/example_fixture.rs index f47540f..62440fa 100644 --- a/examples/example_fixture.rs +++ b/examples/example_fixture.rs @@ -6,10 +6,10 @@ use std::process; fn run() -> Result<(), Box> { if let Ok(text) = env::var("stdout") { - println!("{}", text); + println!("{text}"); } if let Ok(text) = env::var("stderr") { - eprintln!("{}", text); + eprintln!("{text}"); } let code = env::var("exit") @@ -25,7 +25,7 @@ fn main() { let code = match run() { Ok(_) => 0, Err(ref e) => { - write!(&mut io::stderr(), "{}", e).expect("writing to stderr won't fail"); + write!(&mut io::stderr(), "{e}").expect("writing to stderr won't fail"); 1 } }; diff --git a/src/bin/bin_fixture.rs b/src/bin/bin_fixture.rs index f47540f..62440fa 100644 --- a/src/bin/bin_fixture.rs +++ b/src/bin/bin_fixture.rs @@ -6,10 +6,10 @@ use std::process; fn run() -> Result<(), Box> { if let Ok(text) = env::var("stdout") { - println!("{}", text); + println!("{text}"); } if let Ok(text) = env::var("stderr") { - eprintln!("{}", text); + eprintln!("{text}"); } let code = env::var("exit") @@ -25,7 +25,7 @@ fn main() { let code = match run() { Ok(_) => 0, Err(ref e) => { - write!(&mut io::stderr(), "{}", e).expect("writing to stderr won't fail"); + write!(&mut io::stderr(), "{e}").expect("writing to stderr won't fail"); 1 } }; diff --git a/src/error.rs b/src/error.rs index 4f19c40..50311eb 100644 --- a/src/error.rs +++ b/src/error.rs @@ -81,10 +81,10 @@ impl fmt::Display for CargoError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f, "Cargo command failed: {}", self.kind)?; if let Some(ref context) = self.context { - writeln!(f, "{}", context)?; + writeln!(f, "{context}")?; } if let Some(ref cause) = self.cause { - writeln!(f, "Cause: {}", cause)?; + writeln!(f, "Cause: {cause}")?; } Ok(()) } diff --git a/src/format/mod.rs b/src/format/mod.rs index c121b38..2ec94b0 100644 --- a/src/format/mod.rs +++ b/src/format/mod.rs @@ -247,11 +247,11 @@ pub(crate) fn log_message(msg: &Message<'_>) { .map(|s| s.as_ref()) .unwrap_or_else(|| comp.message.message.as_ref()); match comp.message.level { - diagnostic::DiagnosticLevel::Ice => eprintln!("{}", content), - diagnostic::DiagnosticLevel::Error => eprintln!("{}", content), - diagnostic::DiagnosticLevel::Warning => eprintln!("{}", content), - diagnostic::DiagnosticLevel::Note => eprintln!("{}", content), - diagnostic::DiagnosticLevel::Help => eprintln!("{}", content), + diagnostic::DiagnosticLevel::Ice => eprintln!("{content}"), + diagnostic::DiagnosticLevel::Error => eprintln!("{content}"), + diagnostic::DiagnosticLevel::Warning => eprintln!("{content}"), + diagnostic::DiagnosticLevel::Note => eprintln!("{content}"), + diagnostic::DiagnosticLevel::Help => eprintln!("{content}"), #[cfg(not(feature = "strict_unstable"))] _ => eprintln!("Unknown message: {:#?}", msg), } diff --git a/src/run.rs b/src/run.rs index 9e40d30..bf23ae4 100644 --- a/src/run.rs +++ b/src/run.rs @@ -181,12 +181,8 @@ fn extract_binary_path( if bins.is_empty() { return Err(CargoError::new(ErrorKind::CommandFailed).set_context("No binaries in crate")); } else if bins.len() != 1 { - return Err( - CargoError::new(ErrorKind::CommandFailed).set_context(std::format!( - "Ambiguous which binary is intended: {:?}", - bins - )), - ); + return Err(CargoError::new(ErrorKind::CommandFailed) + .set_context(std::format!("Ambiguous which binary is intended: {bins:?}"))); } Ok(bins.into_iter().next().expect("already validated")) } diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 6c37541..edefc74 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -2,7 +2,7 @@ fn test_fixture(name: &str) { let temp = tempfile::TempDir::new().unwrap(); let msgs = escargot::CargoBuild::new() - .manifest_path(format!("tests/testsuite/fixtures/{}/Cargo.toml", name)) + .manifest_path(format!("tests/testsuite/fixtures/{name}/Cargo.toml")) .current_release() .current_target() .target_dir(temp.path()) @@ -12,8 +12,8 @@ fn test_fixture(name: &str) { let raw_msg = msg.unwrap(); let msg = raw_msg.decode(); match msg { - Ok(msg) => println!("{:#?}", msg), - Err(err) => panic!("{}\nmsg=`{:#?}`", err, raw_msg), + Ok(msg) => println!("{msg:#?}"), + Err(err) => panic!("{err}\nmsg=`{raw_msg:#?}`"), } } } @@ -62,7 +62,7 @@ fn test_error() { for msg in &msgs[0..error_idx] { let msg = msg.as_ref().unwrap(); let msg = msg.decode().unwrap(); - println!("{:#?}", msg); + println!("{msg:#?}"); } assert!(msgs[error_idx].is_err()); println!("```{}```", msgs[error_idx].as_ref().err().unwrap()); diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index f94f207..f42975d 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -2,7 +2,7 @@ fn test_fixture(name: &str) { let temp = tempfile::TempDir::new().unwrap(); let cmd = escargot::CargoBuild::new() - .manifest_path(format!("tests/testsuite/fixtures/{}/Cargo.toml", name)) + .manifest_path(format!("tests/testsuite/fixtures/{name}/Cargo.toml")) .current_release() .current_target() .target_dir(temp.path())