diff --git a/src/archive/tar.rs b/src/archive/tar.rs index ff9d3e7..54f144f 100644 --- a/src/archive/tar.rs +++ b/src/archive/tar.rs @@ -140,7 +140,7 @@ where builder.append_file(path, file.file_mut()).map_err(|err| { FinalError::with_title("Could not create archive") .detail("Unexpected error while trying to read file") - .detail(format!("Error: {}.", err)) + .detail(format!("Error: {err}.")) })?; } } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 42d983c..0ef92ef 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -146,7 +146,7 @@ pub fn run( "You are trying to compress a folder." }; - let error = FinalError::with_title(format!("Cannot compress to '{}'.", output_path)) + let error = FinalError::with_title(format!("Cannot compress to '{output_path}'.")) .detail(first_detail_message) .detail(format!( "The compression format '{}' does not accept multiple files.", @@ -154,8 +154,8 @@ pub fn run( )) .detail("Formats that bundle files into an archive are .tar and .zip.") .hint(format!("Try inserting '.tar' or '.zip' before '{}'.", &formats[0])) - .hint(format!("From: {}", output_path)) - .hint(format!("To: {}", suggested_output_path)); + .hint(format!("From: {output_path}")) + .hint(format!("To: {suggested_output_path}")); return Err(error.into()); } @@ -165,14 +165,12 @@ pub fn run( "Cannot compress to '{}'.", EscapedPathDisplay::new(&output_path) )) - .detail(format!("Found the format '{}' in an incorrect position.", format)) + .detail(format!("Found the format '{format}' in an incorrect position.")) .detail(format!( - "'{}' can only be used at the start of the file extension.", - format + "'{format}' can only be used at the start of the file extension." )) .hint(format!( - "If you wish to compress multiple files, start the extension with '{}'.", - format + "If you wish to compress multiple files, start the extension with '{format}'." )) .hint(format!( "Otherwise, remove the last '{}' from '{}'.", diff --git a/src/error.rs b/src/error.rs index 395bd2b..1b567d4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -76,7 +76,7 @@ impl Display for FinalError { if is_running_in_accessible_mode() { write!(f, "\n{}hints:{}", *GREEN, *RESET)?; for hint in &self.hints { - write!(f, "\n{}", hint)?; + write!(f, "\n{hint}")?; } } else { for hint in &self.hints { @@ -138,7 +138,7 @@ impl fmt::Display for Error { Error::Custom { reason } => reason.clone(), }; - write!(f, "{}", err) + write!(f, "{err}") } } diff --git a/src/list.rs b/src/list.rs index 8bed90a..4911fbb 100644 --- a/src/list.rs +++ b/src/list.rs @@ -57,7 +57,7 @@ fn print_entry(name: impl std::fmt::Display, is_dir: bool) { if is_dir { // if colors are deactivated, print final / to mark directories if BLUE.is_empty() { - println!("{}/", name); + println!("{name}/"); // if in ACCESSIBLE mode, use colors but print final / in case colors // aren't read out aloud with a screen reader or aren't printed on a // braille reader @@ -68,7 +68,7 @@ fn print_entry(name: impl std::fmt::Display, is_dir: bool) { } } else { // not a dir -> just print the file name - println!("{}", name); + println!("{name}"); } } @@ -142,7 +142,7 @@ mod tree { false => draw::FINAL_BRANCH, }; - print!("{}{}", prefix, final_part); + print!("{prefix}{final_part}"); let is_dir = match self.file { Some(FileInArchive { is_dir, .. }) => is_dir, None => true, diff --git a/src/main.rs b/src/main.rs index 7abb4f1..e10dc62 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE; fn main() { if let Err(err) = run() { - eprintln!("{}", err); + eprintln!("{err}"); std::process::exit(EXIT_FAILURE); } } diff --git a/src/utils/formatting.rs b/src/utils/formatting.rs index 040c962..cf662f9 100644 --- a/src/utils/formatting.rs +++ b/src/utils/formatting.rs @@ -20,7 +20,7 @@ impl Display for EscapedPathDisplay<'_> { let bstr = bstr::BStr::new(self.path.as_os_str().as_bytes()); - write!(f, "{}", bstr) + write!(f, "{bstr}") } } @@ -47,7 +47,7 @@ impl Display for EscapedPathDisplay<'_> { /// See for a comparison. pub fn to_utf(os_str: &Path) -> Cow { let format = || { - let text = format!("{:?}", os_str); + let text = format!("{os_str:?}"); Cow::Owned(text.trim_matches('"').to_string()) }; diff --git a/src/utils/question.rs b/src/utils/question.rs index 4a77733..713931e 100644 --- a/src/utils/question.rs +++ b/src/utils/question.rs @@ -86,7 +86,7 @@ pub fn user_wants_to_continue( let path = to_utf(strip_cur_dir(path)); let path = Some(&*path); let placeholder = Some("FILE"); - Confirmation::new(&format!("Do you want to {} 'FILE'?", action), placeholder).ask(path) + Confirmation::new(&format!("Do you want to {action} 'FILE'?"), placeholder).ask(path) } } }