diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e75a5492..d1201bf9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -85,7 +85,6 @@ clippy: extends: '.tarball_setup' image: "rust:slim" stage: 'extras' - allow_failure: true script: - rustup component add clippy-preview - - cargo clippy --color=always --all --all-features + - cargo clippy --color=always --all --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless diff --git a/gst-plugin-audiofx/src/audioecho.rs b/gst-plugin-audiofx/src/audioecho.rs index a33ede02..a3187fe0 100644 --- a/gst-plugin-audiofx/src/audioecho.rs +++ b/gst-plugin-audiofx/src/audioecho.rs @@ -54,6 +54,7 @@ struct State { } struct AudioEcho { + #[allow(dead_code)] cat: gst::DebugCategory, settings: Mutex, state: Mutex>, diff --git a/gst-plugin-cdg/src/cdgparse.rs b/gst-plugin-cdg/src/cdgparse.rs index 7260e34b..7f31b531 100644 --- a/gst-plugin-cdg/src/cdgparse.rs +++ b/gst-plugin-cdg/src/cdgparse.rs @@ -164,7 +164,7 @@ impl BaseParseImpl for CdgParse { .enumerate() .find(|(_, byte)| (*byte & CDG_MASK == CDG_COMMAND)) .map(|(i, _)| i) - .unwrap_or(input.get_size()) // skip the whole buffer + .unwrap_or_else(|| input.get_size()) // skip the whole buffer as u32 }; diff --git a/gst-plugin-closedcaption/src/mcc_enc.rs b/gst-plugin-closedcaption/src/mcc_enc.rs index b7c3f9e3..0fe9a05d 100644 --- a/gst-plugin-closedcaption/src/mcc_enc.rs +++ b/gst-plugin-closedcaption/src/mcc_enc.rs @@ -133,6 +133,7 @@ impl MccEnc { }); } + #[allow(clippy::write_with_newline)] fn generate_headers(&self, _state: &State, buffer: &mut Vec) -> Result<(), gst::FlowError> { let settings = self.settings.lock().unwrap(); diff --git a/gst-plugin-closedcaption/src/mcc_parse.rs b/gst-plugin-closedcaption/src/mcc_parse.rs index 86d4f50b..3f7e6c9d 100644 --- a/gst-plugin-closedcaption/src/mcc_parse.rs +++ b/gst-plugin-closedcaption/src/mcc_parse.rs @@ -94,6 +94,8 @@ struct State { need_flush_stop: bool, } +type CombineError<'a> = combine::easy::Errors; + impl Default for State { fn default() -> Self { Self { @@ -156,16 +158,7 @@ fn parse_timecode_rate( } impl State { - fn get_line( - &mut self, - drain: bool, - ) -> Result< - Option, - ( - &[u8], - combine::easy::Errors, - ), - > { + fn get_line(&mut self, drain: bool) -> Result, (&[u8], CombineError)> { let line = if self.replay_last_line { self.replay_last_line = false; &self.last_raw_line @@ -706,12 +699,10 @@ impl MccParse { mode: gst::PadMode, active: bool, ) -> Result<(), gst::LoggableError> { - if active { - if mode == gst::PadMode::Pull { + if mode == gst::PadMode::Pull { + if active { self.start_task(element)?; - } - } else { - if mode == gst::PadMode::Pull { + } else { let _ = self.sinkpad.stop_task(); } } diff --git a/gst-plugin-closedcaption/src/scc_parse.rs b/gst-plugin-closedcaption/src/scc_parse.rs index efb08b43..25f6dffd 100644 --- a/gst-plugin-closedcaption/src/scc_parse.rs +++ b/gst-plugin-closedcaption/src/scc_parse.rs @@ -52,6 +52,8 @@ struct State { last_timecode: Option, } +type CombineError<'a> = combine::easy::Errors; + impl Default for State { fn default() -> Self { Self { @@ -68,16 +70,7 @@ impl Default for State { } impl State { - fn get_line( - &mut self, - drain: bool, - ) -> Result< - Option, - ( - &[u8], - combine::easy::Errors, - ), - > { + fn get_line(&mut self, drain: bool) -> Result, (&[u8], CombineError)> { let line = match self.reader.get_line_with_drain(drain) { None => { return Ok(None); @@ -186,7 +179,7 @@ impl State { &mut self, buffer: &mut gst::buffer::Buffer, timecode: &gst_video::ValidVideoTimeCode, - framerate: &gst::Fraction, + framerate: gst::Fraction, element: &gst::Element, ) { let buffer = buffer.get_mut().unwrap(); @@ -341,7 +334,7 @@ impl SccParse { buf_mut.copy_from_slice(0, d).unwrap(); } - state.add_buffer_metadata(&mut buffer, &timecode, &framerate, element); + state.add_buffer_metadata(&mut buffer, &timecode, framerate, element); timecode.increment_frame(); let buffers = buffers.get_mut().unwrap(); buffers.add(buffer); diff --git a/gst-plugin-flv/src/flvdemux.rs b/gst-plugin-flv/src/flvdemux.rs index b06843a0..efa954f6 100644 --- a/gst-plugin-flv/src/flvdemux.rs +++ b/gst-plugin-flv/src/flvdemux.rs @@ -46,6 +46,7 @@ struct FlvDemux { state: Mutex, } +#[allow(clippy::large_enum_variant)] #[derive(Debug)] enum State { Stopped, @@ -1419,6 +1420,7 @@ impl VideoFormat { } } + #[allow(clippy::useless_let_if_seq)] fn update_with_metadata(&mut self, metadata: &Metadata) -> bool { let mut changed = false; diff --git a/gst-plugin-reqwest/src/reqwesthttpsrc.rs b/gst-plugin-reqwest/src/reqwesthttpsrc.rs index 22047509..e7f49ea7 100644 --- a/gst-plugin-reqwest/src/reqwesthttpsrc.rs +++ b/gst-plugin-reqwest/src/reqwesthttpsrc.rs @@ -123,6 +123,7 @@ static PROPERTIES: [subclass::Property; 6] = [ }), ]; +#[allow(clippy::large_enum_variant)] #[derive(Debug)] enum State { Stopped, diff --git a/gst-plugin-s3/src/s3src.rs b/gst-plugin-s3/src/s3src.rs index d0ca98d9..ed74b48b 100644 --- a/gst-plugin-s3/src/s3src.rs +++ b/gst-plugin-s3/src/s3src.rs @@ -28,6 +28,7 @@ use gst_base::subclass::prelude::*; use crate::s3url::*; use crate::s3utils; +#[allow(clippy::large_enum_variant)] enum StreamingState { Stopped, Started { diff --git a/gst-plugin-threadshare/src/lib.rs b/gst-plugin-threadshare/src/lib.rs index 3ebf8e9d..ecfe6490 100644 --- a/gst-plugin-threadshare/src/lib.rs +++ b/gst-plugin-threadshare/src/lib.rs @@ -16,7 +16,6 @@ // Boston, MA 02110-1335, USA. #![crate_type = "cdylib"] -#![allow(clippy::cast_lossless)] extern crate libc; diff --git a/gst-plugin-threadshare/src/proxy.rs b/gst-plugin-threadshare/src/proxy.rs index 50523610..f50a4782 100644 --- a/gst-plugin-threadshare/src/proxy.rs +++ b/gst-plugin-threadshare/src/proxy.rs @@ -923,8 +923,6 @@ impl ProxySrc { use gst::EventView; let mut new_event = None; - #[allow(clippy::redundant_pattern_matching)] - #[allow(clippy::single_match)] match event.view() { EventView::CustomDownstreamSticky(e) => { let s = e.get_structure().unwrap(); diff --git a/gst-plugin-threadshare/src/queue.rs b/gst-plugin-threadshare/src/queue.rs index 7625f37e..d9ec09db 100644 --- a/gst-plugin-threadshare/src/queue.rs +++ b/gst-plugin-threadshare/src/queue.rs @@ -524,8 +524,6 @@ impl Queue { use gst::QueryView; gst_log!(self.cat, obj: pad, "Handling query {:?}", query); - #[allow(clippy::redundant_pattern_matching)] - #[allow(clippy::single_match)] match query.view_mut() { QueryView::Scheduling(ref mut q) => { let mut new_query = gst::Query::new_scheduling(); diff --git a/gst-plugin-tutorial/src/progressbin.rs b/gst-plugin-tutorial/src/progressbin.rs index 344059a4..cd59bf04 100644 --- a/gst-plugin-tutorial/src/progressbin.rs +++ b/gst-plugin-tutorial/src/progressbin.rs @@ -16,6 +16,7 @@ use gst::subclass::prelude::*; // Struct containing all the element data struct ProgressBin { + #[allow(dead_code)] cat: gst::DebugCategory, progress: gst::Element, srcpad: gst::GhostPad,