diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-01-25 11:23:46 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-01-25 11:31:19 +0300 |
commit | 3b4c48d9f55ae5bfb6eb4fe485edf54f8916d955 (patch) | |
tree | 69f065a49d4035b924d0c1f7025186d597a55590 /audio/audiofx | |
parent | ad3f1cf534b475d47d4ef4d0e8916d507c6e56e5 (diff) |
Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1062>
Diffstat (limited to 'audio/audiofx')
-rw-r--r-- | audio/audiofx/examples/hrtfrender.rs | 7 | ||||
-rw-r--r-- | audio/audiofx/src/ebur128level/imp.rs | 4 | ||||
-rw-r--r-- | audio/audiofx/tests/audioloudnorm.rs | 31 |
3 files changed, 12 insertions, 30 deletions
diff --git a/audio/audiofx/examples/hrtfrender.rs b/audio/audiofx/examples/hrtfrender.rs index 86a71b62..98acc158 100644 --- a/audio/audiofx/examples/hrtfrender.rs +++ b/audio/audiofx/examples/hrtfrender.rs @@ -37,9 +37,8 @@ fn run() -> Result<(), Error> { let hrir = &args[2]; let pipeline = gst::parse_launch(&format!( - "uridecodebin uri={} ! audioconvert ! audio/x-raw,channels=1 ! - hrtfrender hrir-file={} name=hrtf ! audioresample ! autoaudiosink", - uri, hrir + "uridecodebin uri={uri} ! audioconvert ! audio/x-raw,channels=1 ! + hrtfrender hrir-file={hrir} name=hrtf ! audioresample ! autoaudiosink" ))? .downcast::<gst::Pipeline>() .expect("type error"); @@ -142,6 +141,6 @@ fn run() -> Result<(), Error> { fn main() { match run() { Ok(r) => r, - Err(e) => eprintln!("Error! {}", e), + Err(e) => eprintln!("Error! {e}"), } } diff --git a/audio/audiofx/src/ebur128level/imp.rs b/audio/audiofx/src/ebur128level/imp.rs index add9de30..bb39445b 100644 --- a/audio/audiofx/src/ebur128level/imp.rs +++ b/audio/audiofx/src/ebur128level/imp.rs @@ -779,8 +779,8 @@ fn non_interleaved_channel_data_into_slices<'a, T: FromByteSlice>( /// Split a vector of slices into a tuple of slices with each slice split at `split_at`. #[allow(clippy::type_complexity)] -fn split_vec<'a, 'b, T: Copy>( - vec: &'b SmallVec<[&'a [T]; 64]>, +fn split_vec<'a, T: Copy>( + vec: &SmallVec<[&'a [T]; 64]>, split_at: usize, ) -> (SmallVec<[&'a [T]; 64]>, SmallVec<[&'a [T]; 64]>) { let VecPair(first, second) = vec diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index 7e9d878e..4fd14b0f 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -33,9 +33,9 @@ fn run_test( init(); let format = if cfg!(target_endian = "little") { - format!("audio/x-raw,format=F64LE,rate=192000,channels={}", channels) + format!("audio/x-raw,format=F64LE,rate=192000,channels={channels}") } else { - format!("audio/x-raw,format=F64BE,rate=192000,channels={}", channels) + format!("audio/x-raw,format=F64BE,rate=192000,channels={channels}") }; let pipeline = if let Some(second_input) = second_input { @@ -51,10 +51,6 @@ fn run_test( } else { gst::parse_launch(&format!( "audiotestsrc {first_input} num-buffers={num_buffers} samplesperbuffer={samples_per_buffer} ! {format} ! audioloudnorm ! appsink name=sink", - first_input = first_input, - num_buffers = num_buffers, - samples_per_buffer = samples_per_buffer, - format = format, )) } .unwrap() @@ -129,17 +125,13 @@ fn run_test( Ordering::Greater => { assert!( ts - expected_ts <= gst::ClockTime::NSECOND, - "TS is {} instead of {}", - ts, - expected_ts + "TS is {ts} instead of {expected_ts}" ); } Ordering::Less => { assert!( expected_ts - ts <= gst::ClockTime::NSECOND, - "TS is {} instead of {}", - ts, - expected_ts + "TS is {ts} instead of {expected_ts}" ); } Ordering::Equal => (), @@ -164,27 +156,18 @@ fn run_test( if expected_loudness.classify() == std::num::FpCategory::Infinite && expected_loudness < 0.0 { assert!( loudness.classify() == std::num::FpCategory::Infinite && loudness < 0.0, - "Loudness is {} instead of {}", - loudness, - expected_loudness, + "Loudness is {loudness} instead of {expected_loudness}", ); } else { assert!( f64::abs(loudness - expected_loudness) < 1.0, - "Loudness is {} instead of {}", - loudness, - expected_loudness, + "Loudness is {loudness} instead of {expected_loudness}", ); } for c in 0..channels { let peak = 20.0 * f64::log10(r128.sample_peak(c).unwrap()); - assert!( - peak <= -2.0, - "Peak {} for channel {} is above -2.0", - c, - peak, - ); + assert!(peak <= -2.0, "Peak {c} for channel {peak} is above -2.0",); } } |