From a94d84e7805196364b4fc584205ce4882f3acd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 20 Jun 2021 10:03:46 +0300 Subject: [PATCH] Silence/fix various clippy warnings --- .gitlab-ci.yml | 2 +- gstreamer-audio/src/audio_format.rs | 4 +--- gstreamer-audio/src/audio_meta.rs | 4 ++-- gstreamer-rtp/src/rtp_buffer.rs | 2 +- gstreamer-video/src/video_format.rs | 4 +--- gstreamer/src/clock_time.rs | 6 +++--- gstreamer/src/event.rs | 2 +- gstreamer/src/subclass/element.rs | 2 +- 8 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e4e3a5e4..1932e203f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -345,7 +345,7 @@ clippy: extends: .img-stable stage: 'extras' 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: - cargo clippy --version # Keep features in sync with above diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index b81452473..99c891f5b 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -363,9 +363,7 @@ mod tests { assert_eq!(count, crate::AudioFormat::iter_raw().len()); assert!(crate::AudioFormat::iter_raw().any(|f| f == crate::AudioFormat::F64be)); - assert!(crate::AudioFormat::iter_raw() - .find(|f| *f == crate::AudioFormat::Encoded) - .is_none()); + assert!(!crate::AudioFormat::iter_raw().any(|f| f == crate::AudioFormat::Encoded)); let caps = crate::AudioFormat::iter_raw().into_audio_caps(crate::AudioLayout::Interleaved); assert!(caps.is_some()); diff --git a/gstreamer-audio/src/audio_meta.rs b/gstreamer-audio/src/audio_meta.rs index 9a15a7e2c..07dc051d9 100644 --- a/gstreamer-audio/src/audio_meta.rs +++ b/gstreamer-audio/src/audio_meta.rs @@ -325,13 +325,13 @@ mod tests { { let cmeta = AudioLevelMeta::add(buffer.get_mut().unwrap(), 10, true); assert_eq!(cmeta.level(), 10); - assert_eq!(cmeta.voice_activity(), true); + assert!(cmeta.voice_activity()); } { let cmeta = buffer.meta::().unwrap(); assert_eq!(cmeta.level(), 10); - assert_eq!(cmeta.voice_activity(), true); + assert!(cmeta.voice_activity()); } } } diff --git a/gstreamer-rtp/src/rtp_buffer.rs b/gstreamer-rtp/src/rtp_buffer.rs index 8fd647fcf..a875bc5b0 100644 --- a/gstreamer-rtp/src/rtp_buffer.rs +++ b/gstreamer-rtp/src/rtp_buffer.rs @@ -425,7 +425,7 @@ mod tests { assert!(rtp_buffer.csrc(2).is_none()); rtp_buffer.set_extension(true); - assert_eq!(rtp_buffer.is_extension(), true); + assert!(rtp_buffer.is_extension()); assert_eq!(rtp_buffer.extension_bytes(), None); } diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index e38f6c900..bfe19d91b 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -506,9 +506,7 @@ mod tests { assert_eq!(count, crate::VideoFormat::iter_raw().len()); assert!(crate::VideoFormat::iter_raw().any(|f| f == crate::VideoFormat::Nv12)); - assert!(crate::VideoFormat::iter_raw() - .find(|f| *f == crate::VideoFormat::Encoded) - .is_none()); + assert!(!crate::VideoFormat::iter_raw().any(|f| f == crate::VideoFormat::Encoded)); let caps = crate::VideoFormat::iter_raw().into_video_caps(); assert!(caps.is_some()); diff --git a/gstreamer/src/clock_time.rs b/gstreamer/src/clock_time.rs index d6c598412..461eafcd8 100644 --- a/gstreamer/src/clock_time.rs +++ b/gstreamer/src/clock_time.rs @@ -556,11 +556,11 @@ mod tests { assert!(ct_3 > ct_0); assert!(Some(ct_3) > Some(ct_0)); - assert_eq!(opt_ct_none < None, false); - assert_eq!(opt_ct_none > None, false); + assert!(!(opt_ct_none < None)); + assert!(!(opt_ct_none > None)); // This doesn't work due to the `PartialOrd` impl on `Option` //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] diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index e339048f8..9867791ea 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -2021,7 +2021,7 @@ mod tests { .build(); match flush_stop_evt.view() { 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()); if let Some(other_fields) = flush_stop_evt.structure() { assert!(other_fields.has_field("extra-field")); diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 1d0413e74..64c92a251 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -804,6 +804,6 @@ mod tests { let imp = imp::TestElement::from_instance(&element); 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)); } }