mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-23 02:26:35 +00:00
Fix or silence all remaining clippy warnings
Also ignore common errors we don't care about when running clippy and make clippy errors fail the CI.
This commit is contained in:
parent
2c7775125a
commit
83cc8104a1
13 changed files with 20 additions and 35 deletions
|
@ -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
|
||||
|
|
|
@ -54,6 +54,7 @@ struct State {
|
|||
}
|
||||
|
||||
struct AudioEcho {
|
||||
#[allow(dead_code)]
|
||||
cat: gst::DebugCategory,
|
||||
settings: Mutex<Settings>,
|
||||
state: Mutex<Option<State>>,
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ impl MccEnc {
|
|||
});
|
||||
}
|
||||
|
||||
#[allow(clippy::write_with_newline)]
|
||||
fn generate_headers(&self, _state: &State, buffer: &mut Vec<u8>) -> Result<(), gst::FlowError> {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
|
||||
|
|
|
@ -94,6 +94,8 @@ struct State {
|
|||
need_flush_stop: bool,
|
||||
}
|
||||
|
||||
type CombineError<'a> = combine::easy::Errors<u8, &'a [u8], combine::stream::PointerOffset>;
|
||||
|
||||
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<MccLine>,
|
||||
(
|
||||
&[u8],
|
||||
combine::easy::Errors<u8, &[u8], combine::stream::PointerOffset>,
|
||||
),
|
||||
> {
|
||||
fn get_line(&mut self, drain: bool) -> Result<Option<MccLine>, (&[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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ struct State {
|
|||
last_timecode: Option<gst_video::ValidVideoTimeCode>,
|
||||
}
|
||||
|
||||
type CombineError<'a> = combine::easy::Errors<u8, &'a [u8], combine::stream::PointerOffset>;
|
||||
|
||||
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<SccLine>,
|
||||
(
|
||||
&[u8],
|
||||
combine::easy::Errors<u8, &[u8], combine::stream::PointerOffset>,
|
||||
),
|
||||
> {
|
||||
fn get_line(&mut self, drain: bool) -> Result<Option<SccLine>, (&[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);
|
||||
|
|
|
@ -46,6 +46,7 @@ struct FlvDemux {
|
|||
state: Mutex<State>,
|
||||
}
|
||||
|
||||
#[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;
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ static PROPERTIES: [subclass::Property; 6] = [
|
|||
}),
|
||||
];
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug)]
|
||||
enum State {
|
||||
Stopped,
|
||||
|
|
|
@ -28,6 +28,7 @@ use gst_base::subclass::prelude::*;
|
|||
use crate::s3url::*;
|
||||
use crate::s3utils;
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum StreamingState {
|
||||
Stopped,
|
||||
Started {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
// Boston, MA 02110-1335, USA.
|
||||
|
||||
#![crate_type = "cdylib"]
|
||||
#![allow(clippy::cast_lossless)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue