mirror of
https://github.com/ouch-org/ouch.git
synced 2025-07-18 23:50:35 +00:00
Fix clippy warnings
This commit is contained in:
parent
945ffde551
commit
92d2a1a625
@ -56,8 +56,7 @@ pub fn check_mime_type(
|
||||
.ends_with(detected_format.compression_formats)
|
||||
{
|
||||
warning(format!(
|
||||
"The file extension: `{}` differ from the detected extension: `{}`",
|
||||
outer_ext, detected_format
|
||||
"The file extension: `{outer_ext}` differ from the detected extension: `{detected_format}`"
|
||||
));
|
||||
|
||||
if !user_wants_to_continue(path, question_policy, QuestionAction::Decompression)? {
|
||||
|
@ -295,7 +295,7 @@ pub fn decompress_file(options: DecompressOptions) -> crate::Result<()> {
|
||||
"Successfully decompressed archive in {}",
|
||||
nice_directory_display(options.output_dir)
|
||||
));
|
||||
info_accessible(format!("Files unpacked: {}", files_unpacked));
|
||||
info_accessible(format!("Files unpacked: {files_unpacked}"));
|
||||
|
||||
if !input_is_stdin && options.remove {
|
||||
fs::remove_file(options.input_file_path)?;
|
||||
|
@ -139,8 +139,8 @@ impl FinalError {
|
||||
/// hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
||||
/// ```
|
||||
pub fn hint_all_supported_formats(self) -> Self {
|
||||
self.hint(format!("Supported extensions are: {}", PRETTY_SUPPORTED_EXTENSIONS))
|
||||
.hint(format!("Supported aliases are: {}", PRETTY_SUPPORTED_ALIASES))
|
||||
self.hint(format!("Supported extensions are: {PRETTY_SUPPORTED_EXTENSIONS}"))
|
||||
.hint(format!("Supported aliases are: {PRETTY_SUPPORTED_ALIASES}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ pub fn parse_format_flag(input: &OsStr) -> crate::Result<Vec<Extension>> {
|
||||
.map(|extension| {
|
||||
to_extension(extension.as_bytes()).ok_or_else(|| Error::InvalidFormatFlag {
|
||||
text: input.to_owned(),
|
||||
reason: format!("Unsupported extension '{}'", extension),
|
||||
reason: format!("Unsupported extension '{extension}'"),
|
||||
})
|
||||
})
|
||||
.collect::<crate::Result<_>>()?;
|
||||
|
@ -109,7 +109,7 @@ impl std::fmt::Display for Bytes {
|
||||
|
||||
debug_assert!(num >= 0.0);
|
||||
if num < 1_f64 {
|
||||
return write!(f, "{:>6.2} B", num);
|
||||
return write!(f, "{num:>6.2} B");
|
||||
}
|
||||
|
||||
let delimiter = 1000_f64;
|
||||
|
@ -82,7 +82,7 @@ pub fn rename_or_increment_filename(path: &Path) -> PathBuf {
|
||||
let number = number_str.parse::<u32>().unwrap_or(0);
|
||||
format!("{}_{}", base, number + 1)
|
||||
}
|
||||
_ => format!("{}_1", filename),
|
||||
_ => format!("{filename}_1"),
|
||||
};
|
||||
|
||||
let mut new_path = parent.join(new_filename);
|
||||
|
@ -187,7 +187,7 @@ impl<'a, T: Default> ChoicePrompt<'a, T> {
|
||||
|
||||
#[cfg(not(feature = "allow_piped_choice"))]
|
||||
if !stdin().is_terminal() {
|
||||
eprintln!("{}", message);
|
||||
eprintln!("{message}");
|
||||
eprintln!("Pass --yes to proceed");
|
||||
return Ok(T::default());
|
||||
}
|
||||
@ -222,10 +222,10 @@ impl<'a, T: Default> ChoicePrompt<'a, T> {
|
||||
.collect::<Vec<_>>()
|
||||
.join("/");
|
||||
|
||||
format!("[{}]", choises)
|
||||
format!("[{choises}]")
|
||||
};
|
||||
|
||||
eprintln!("{} {}", message, choice_prompt);
|
||||
eprintln!("{message} {choice_prompt}");
|
||||
|
||||
let mut answer = String::new();
|
||||
let bytes_read = stdin_lock.read_line(&mut answer)?;
|
||||
@ -284,7 +284,7 @@ impl<'a> Confirmation<'a> {
|
||||
|
||||
#[cfg(not(feature = "allow_piped_choice"))]
|
||||
if !stdin().is_terminal() {
|
||||
eprintln!("{}", message);
|
||||
eprintln!("{message}");
|
||||
eprintln!("Pass --yes to proceed");
|
||||
return Ok(false);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ fn single_file_stdin(
|
||||
fs::create_dir(before).unwrap();
|
||||
let before_file = &before.join("file");
|
||||
let format = merge_extensions(&ext, &exts);
|
||||
let archive = &dir.join(format!("file.{}", format));
|
||||
let archive = &dir.join(format!("file.{format}"));
|
||||
let after = &dir.join("after");
|
||||
write_random_content(
|
||||
&mut fs::File::create(before_file).unwrap(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user