Merge pull request #588 from hamirmahal/style/simplify-string-formatting

style: simplify string formatting
This commit is contained in:
David Kleingeld 2024-07-04 11:29:13 +02:00 committed by GitHub
commit 3a23d2c529
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 9 additions and 11 deletions

View file

@ -151,7 +151,7 @@ mod test {
let mut converter = ChannelCountConverter::new(input.iter().copied(), from, to);
let count = converter.clone().count();
for left_in_iter in (0..=count).rev() {
println!("left_in_iter = {}", left_in_iter);
println!("left_in_iter = {left_in_iter}");
assert_eq!(converter.size_hint(), (left_in_iter, Some(left_in_iter)));
converter.next();
}

View file

@ -352,7 +352,7 @@ impl FromStr for Mp4Type {
"m4r" => Ok(Mp4Type::M4r),
"m4v" => Ok(Mp4Type::M4v),
"mov" => Ok(Mp4Type::Mov),
_ => Err(format!("{} is not a valid mp4 extension", input)),
_ => Err(format!("{input} is not a valid mp4 extension")),
}
}
}
@ -368,7 +368,7 @@ impl fmt::Display for Mp4Type {
Mp4Type::M4v => "m4v",
Mp4Type::Mov => "mov",
};
write!(f, "{}", text)
write!(f, "{text}")
}
}
@ -568,7 +568,7 @@ impl fmt::Display for DecoderError {
#[cfg(feature = "symphonia")]
DecoderError::NoStreams => "No streams",
};
write!(f, "{}", text)
write!(f, "{text}")
}
}

View file

@ -90,10 +90,9 @@ where
self.samples_read += 1;
i32_to_i16(value.unwrap_or(0))
}),
(sample_format, bits_per_sample) => panic!(
"Unimplemented wav spec: {:?}, {}",
sample_format, bits_per_sample
),
(sample_format, bits_per_sample) => {
panic!("Unimplemented wav spec: {sample_format:?}, {bits_per_sample}")
}
}
}

View file

@ -208,7 +208,7 @@ impl CpalDeviceExt for cpal::Device {
let (mixer_tx, mut mixer_rx) =
dynamic_mixer::mixer::<f32>(format.channels(), format.sample_rate().0);
let error_callback = |err| eprintln!("an error occurred on output stream: {}", err);
let error_callback = |err| eprintln!("an error occurred on output stream: {err}");
match format.sample_format() {
cpal::SampleFormat::F32 => self.build_output_stream::<f32, _, _>(

View file

@ -17,8 +17,7 @@ fn test_flac_encodings() {
// 24 bit FLAC file exported from Audacity (2 channels, various compression levels)
for level in &[0, 5, 8] {
let file =
std::fs::File::open(format!("assets/audacity24bit_level{}.flac", level)).unwrap();
let file = std::fs::File::open(format!("assets/audacity24bit_level{level}.flac")).unwrap();
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
assert!(decoder.any(|x| x != 0));
#[cfg(all(feature = "flac", not(feature = "symphonia-flac")))]