Fix/silence some clippy warnings

This commit is contained in:
Sebastian Dröge 2020-04-14 11:59:08 +03:00 committed by Sebastian Dröge
parent 8370fb8a11
commit 5435ea1b7c
3 changed files with 31 additions and 17 deletions

View file

@ -1072,7 +1072,14 @@ impl State {
// Gain reduction at the new start. Note the plus as the slope is
// negative already here.
self.gain_reduction[0] = self.gain_reduction[0] + new_start * old_slope;
//
// Clippy warning ignored here because this is just incidentally the same as
// AssignAdd: we calculate a new adjusted gain reduction here, and override the
// previous one.
#[allow(clippy::assign_op_pattern)]
{
self.gain_reduction[0] = self.gain_reduction[0] + new_start * old_slope;
}
// At env_cnt == ATTACK_WINDOW we need the new gain reduction
self.gain_reduction[1] = gain_reduction;

View file

@ -138,23 +138,29 @@ fn run_test(
let mut num_samples = 0;
let mut expected_ts = gst::ClockTime::from(0);
for sample in samples.iter() {
use std::cmp::Ordering;
let buf = sample.get_buffer().unwrap();
let ts = buf.get_pts();
if ts > expected_ts {
assert!(
ts - expected_ts <= gst::ClockTime::from(1),
"TS is {} instead of {}",
ts,
expected_ts
);
} else if ts < expected_ts {
assert!(
expected_ts - ts <= gst::ClockTime::from(1),
"TS is {} instead of {}",
ts,
expected_ts
);
match ts.cmp(&expected_ts) {
Ordering::Greater => {
assert!(
ts - expected_ts <= gst::ClockTime::from(1),
"TS is {} instead of {}",
ts,
expected_ts
);
}
Ordering::Less => {
assert!(
expected_ts - ts <= gst::ClockTime::from(1),
"TS is {} instead of {}",
ts,
expected_ts
);
}
Ordering::Equal => (),
}
let map = buf.map_readable().unwrap();

View file

@ -403,10 +403,11 @@ impl Transcriber {
"AWS raised an error: {}",
message.message
);
Err(gst_error_msg!(
return Err(gst_error_msg!(
gst::StreamError::Failed,
["AWS raised an error: {}", message.message]
))?;
));
}
let mut transcript: Transcript =