Skip to content

Commit d049450

Browse files
authored
Fix clippy warnings (#833)
1 parent 945ffde commit d049450

8 files changed

Lines changed: 12 additions & 13 deletions

File tree

src/check.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ pub fn check_mime_type(
5656
.ends_with(detected_format.compression_formats)
5757
{
5858
warning(format!(
59-
"The file extension: `{}` differ from the detected extension: `{}`",
60-
outer_ext, detected_format
59+
"The file extension: `{outer_ext}` differ from the detected extension: `{detected_format}`"
6160
));
6261

6362
if !user_wants_to_continue(path, question_policy, QuestionAction::Decompression)? {

src/commands/decompress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ pub fn decompress_file(options: DecompressOptions) -> crate::Result<()> {
295295
"Successfully decompressed archive in {}",
296296
nice_directory_display(options.output_dir)
297297
));
298-
info_accessible(format!("Files unpacked: {}", files_unpacked));
298+
info_accessible(format!("Files unpacked: {files_unpacked}"));
299299

300300
if !input_is_stdin && options.remove {
301301
fs::remove_file(options.input_file_path)?;

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ impl FinalError {
139139
/// hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
140140
/// ```
141141
pub fn hint_all_supported_formats(self) -> Self {
142-
self.hint(format!("Supported extensions are: {}", PRETTY_SUPPORTED_EXTENSIONS))
143-
.hint(format!("Supported aliases are: {}", PRETTY_SUPPORTED_ALIASES))
142+
self.hint(format!("Supported extensions are: {PRETTY_SUPPORTED_EXTENSIONS}"))
143+
.hint(format!("Supported aliases are: {PRETTY_SUPPORTED_ALIASES}"))
144144
}
145145
}
146146

src/extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub fn parse_format_flag(input: &OsStr) -> crate::Result<Vec<Extension>> {
173173
.map(|extension| {
174174
to_extension(extension.as_bytes()).ok_or_else(|| Error::InvalidFormatFlag {
175175
text: input.to_owned(),
176-
reason: format!("Unsupported extension '{}'", extension),
176+
reason: format!("Unsupported extension '{extension}'"),
177177
})
178178
})
179179
.collect::<crate::Result<_>>()?;

src/utils/formatting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl std::fmt::Display for Bytes {
109109

110110
debug_assert!(num >= 0.0);
111111
if num < 1_f64 {
112-
return write!(f, "{:>6.2} B", num);
112+
return write!(f, "{num:>6.2} B");
113113
}
114114

115115
let delimiter = 1000_f64;

src/utils/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn rename_or_increment_filename(path: &Path) -> PathBuf {
8282
let number = number_str.parse::<u32>().unwrap_or(0);
8383
format!("{}_{}", base, number + 1)
8484
}
85-
_ => format!("{}_1", filename),
85+
_ => format!("{filename}_1"),
8686
};
8787

8888
let mut new_path = parent.join(new_filename);

src/utils/question.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<'a, T: Default> ChoicePrompt<'a, T> {
187187

188188
#[cfg(not(feature = "allow_piped_choice"))]
189189
if !stdin().is_terminal() {
190-
eprintln!("{}", message);
190+
eprintln!("{message}");
191191
eprintln!("Pass --yes to proceed");
192192
return Ok(T::default());
193193
}
@@ -222,10 +222,10 @@ impl<'a, T: Default> ChoicePrompt<'a, T> {
222222
.collect::<Vec<_>>()
223223
.join("/");
224224

225-
format!("[{}]", choises)
225+
format!("[{choises}]")
226226
};
227227

228-
eprintln!("{} {}", message, choice_prompt);
228+
eprintln!("{message} {choice_prompt}");
229229

230230
let mut answer = String::new();
231231
let bytes_read = stdin_lock.read_line(&mut answer)?;
@@ -284,7 +284,7 @@ impl<'a> Confirmation<'a> {
284284

285285
#[cfg(not(feature = "allow_piped_choice"))]
286286
if !stdin().is_terminal() {
287-
eprintln!("{}", message);
287+
eprintln!("{message}");
288288
eprintln!("Pass --yes to proceed");
289289
return Ok(false);
290290
}

tests/integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ fn single_file_stdin(
175175
fs::create_dir(before).unwrap();
176176
let before_file = &before.join("file");
177177
let format = merge_extensions(&ext, &exts);
178-
let archive = &dir.join(format!("file.{}", format));
178+
let archive = &dir.join(format!("file.{format}"));
179179
let after = &dir.join("after");
180180
write_random_content(
181181
&mut fs::File::create(before_file).unwrap(),

0 commit comments

Comments
 (0)