Silence/fix various clippy warnings

This commit is contained in:
Sebastian Dröge 2021-06-20 10:03:46 +03:00
parent 156dffd00e
commit a94d84e780
8 changed files with 11 additions and 15 deletions

View file

@ -345,7 +345,7 @@ clippy:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
variables: variables:
CLIPPY_LINTS: -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::upper_case_acronyms -D warnings CLIPPY_LINTS: -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::upper_case_acronyms -A clippy::wrong_self_convention -D warnings
script: script:
- cargo clippy --version - cargo clippy --version
# Keep features in sync with above # Keep features in sync with above

View file

@ -363,9 +363,7 @@ mod tests {
assert_eq!(count, crate::AudioFormat::iter_raw().len()); assert_eq!(count, crate::AudioFormat::iter_raw().len());
assert!(crate::AudioFormat::iter_raw().any(|f| f == crate::AudioFormat::F64be)); assert!(crate::AudioFormat::iter_raw().any(|f| f == crate::AudioFormat::F64be));
assert!(crate::AudioFormat::iter_raw() assert!(!crate::AudioFormat::iter_raw().any(|f| f == crate::AudioFormat::Encoded));
.find(|f| *f == crate::AudioFormat::Encoded)
.is_none());
let caps = crate::AudioFormat::iter_raw().into_audio_caps(crate::AudioLayout::Interleaved); let caps = crate::AudioFormat::iter_raw().into_audio_caps(crate::AudioLayout::Interleaved);
assert!(caps.is_some()); assert!(caps.is_some());

View file

@ -325,13 +325,13 @@ mod tests {
{ {
let cmeta = AudioLevelMeta::add(buffer.get_mut().unwrap(), 10, true); let cmeta = AudioLevelMeta::add(buffer.get_mut().unwrap(), 10, true);
assert_eq!(cmeta.level(), 10); assert_eq!(cmeta.level(), 10);
assert_eq!(cmeta.voice_activity(), true); assert!(cmeta.voice_activity());
} }
{ {
let cmeta = buffer.meta::<AudioLevelMeta>().unwrap(); let cmeta = buffer.meta::<AudioLevelMeta>().unwrap();
assert_eq!(cmeta.level(), 10); assert_eq!(cmeta.level(), 10);
assert_eq!(cmeta.voice_activity(), true); assert!(cmeta.voice_activity());
} }
} }
} }

View file

@ -425,7 +425,7 @@ mod tests {
assert!(rtp_buffer.csrc(2).is_none()); assert!(rtp_buffer.csrc(2).is_none());
rtp_buffer.set_extension(true); rtp_buffer.set_extension(true);
assert_eq!(rtp_buffer.is_extension(), true); assert!(rtp_buffer.is_extension());
assert_eq!(rtp_buffer.extension_bytes(), None); assert_eq!(rtp_buffer.extension_bytes(), None);
} }

View file

@ -506,9 +506,7 @@ mod tests {
assert_eq!(count, crate::VideoFormat::iter_raw().len()); assert_eq!(count, crate::VideoFormat::iter_raw().len());
assert!(crate::VideoFormat::iter_raw().any(|f| f == crate::VideoFormat::Nv12)); assert!(crate::VideoFormat::iter_raw().any(|f| f == crate::VideoFormat::Nv12));
assert!(crate::VideoFormat::iter_raw() assert!(!crate::VideoFormat::iter_raw().any(|f| f == crate::VideoFormat::Encoded));
.find(|f| *f == crate::VideoFormat::Encoded)
.is_none());
let caps = crate::VideoFormat::iter_raw().into_video_caps(); let caps = crate::VideoFormat::iter_raw().into_video_caps();
assert!(caps.is_some()); assert!(caps.is_some());

View file

@ -556,11 +556,11 @@ mod tests {
assert!(ct_3 > ct_0); assert!(ct_3 > ct_0);
assert!(Some(ct_3) > Some(ct_0)); assert!(Some(ct_3) > Some(ct_0));
assert_eq!(opt_ct_none < None, false); assert!(!(opt_ct_none < None));
assert_eq!(opt_ct_none > None, false); assert!(!(opt_ct_none > None));
// This doesn't work due to the `PartialOrd` impl on `Option<T>` // This doesn't work due to the `PartialOrd` impl on `Option<T>`
//assert_eq!(Some(ct_0) > opt_ct_none, false); //assert_eq!(Some(ct_0) > opt_ct_none, false);
assert_eq!(Some(ct_0) < opt_ct_none, false); assert!(!(Some(ct_0) < opt_ct_none));
} }
#[test] #[test]

View file

@ -2021,7 +2021,7 @@ mod tests {
.build(); .build();
match flush_stop_evt.view() { match flush_stop_evt.view() {
EventView::FlushStop(flush_stop_evt) => { EventView::FlushStop(flush_stop_evt) => {
assert_eq!(flush_stop_evt.resets_time(), true); assert!(flush_stop_evt.resets_time());
assert!(flush_stop_evt.structure().is_some()); assert!(flush_stop_evt.structure().is_some());
if let Some(other_fields) = flush_stop_evt.structure() { if let Some(other_fields) = flush_stop_evt.structure() {
assert!(other_fields.has_field("extra-field")); assert!(other_fields.has_field("extra-field"));

View file

@ -804,6 +804,6 @@ mod tests {
let imp = imp::TestElement::from_instance(&element); let imp = imp::TestElement::from_instance(&element);
assert_eq!(imp.n_buffers.load(atomic::Ordering::SeqCst), 100); assert_eq!(imp.n_buffers.load(atomic::Ordering::SeqCst), 100);
assert_eq!(imp.reached_playing.load(atomic::Ordering::SeqCst), true); assert!(imp.reached_playing.load(atomic::Ordering::SeqCst));
} }
} }