mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
Fix or ignore various clippy warnings
And ignore some common warnings we don't care about in general, while also making clippy errors fail the build.
This commit is contained in:
parent
105412b5a0
commit
ea367bac14
7 changed files with 38 additions and 20 deletions
|
@ -124,7 +124,6 @@ clippy:
|
|||
extends: '.tarball_setup'
|
||||
image: "rust:slim"
|
||||
stage: 'extras'
|
||||
allow_failure: true
|
||||
script:
|
||||
- rustup component add clippy-preview
|
||||
- cargo clippy --version
|
||||
|
@ -141,5 +140,9 @@ clippy:
|
|||
FEATURES=v1_16
|
||||
fi
|
||||
|
||||
cargo clippy --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES
|
||||
cargo clippy --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless
|
||||
done
|
||||
# And also run over all the examples/tutorials
|
||||
- |
|
||||
cargo clippy --color=always --manifest-path examples/Cargo.toml --bins --examples --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless
|
||||
cargo clippy --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless
|
||||
|
|
|
@ -408,6 +408,7 @@ impl App {
|
|||
gst_gl::GLPlatform::GLX,
|
||||
)
|
||||
}
|
||||
#[allow(unreachable_patterns)]
|
||||
handler => panic!("Unsupported platform: {:?}.", handler),
|
||||
};
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
|
|||
#[allow(clippy::too_many_arguments)]
|
||||
#[allow(clippy::match_same_arms)]
|
||||
#[allow(clippy::type_complexity)]
|
||||
#[allow(clippy::let_and_return)]
|
||||
mod auto;
|
||||
pub use auto::*;
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ impl VideoFormatInfo {
|
|||
(-((-(i64::from(height))) >> self.h_sub()[component as usize])) as u32
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn unpack(
|
||||
&self,
|
||||
flags: ::VideoPackFlags,
|
||||
|
@ -220,6 +221,7 @@ impl VideoFormatInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn pack(
|
||||
&self,
|
||||
flags: ::VideoPackFlags,
|
||||
|
|
|
@ -130,7 +130,7 @@ impl TryFrom<DateTimeVariants> for Date {
|
|||
impl<'de> Deserialize<'de> for Date {
|
||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
DateTimeVariants::deserialize(deserializer)
|
||||
.and_then(|dt_variant| dt_variant.try_into().map_err(|err| D::Error::custom(err)))
|
||||
.and_then(|dt_variant| dt_variant.try_into().map_err(D::Error::custom))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1410,24 +1410,30 @@ impl<'a> SeekBuilder<'a> {
|
|||
}
|
||||
|
||||
event_builder_generic_impl!(|s: &Self| {
|
||||
let ev = gst_sys::gst_event_new_seek(
|
||||
s.rate,
|
||||
s.start.get_format().to_glib(),
|
||||
s.flags.to_glib(),
|
||||
s.start_type.to_glib(),
|
||||
s.start.get_value(),
|
||||
s.stop_type.to_glib(),
|
||||
s.stop.get_value(),
|
||||
);
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[allow(clippy::let_and_return)]
|
||||
{
|
||||
if let Some(trickmode_interval) = s.trickmode_interval {
|
||||
gst_sys::gst_event_set_seek_trickmode_interval(ev, trickmode_interval.to_glib());
|
||||
}
|
||||
}
|
||||
let ev = gst_sys::gst_event_new_seek(
|
||||
s.rate,
|
||||
s.start.get_format().to_glib(),
|
||||
s.flags.to_glib(),
|
||||
s.start_type.to_glib(),
|
||||
s.start.get_value(),
|
||||
s.stop_type.to_glib(),
|
||||
s.stop.get_value(),
|
||||
);
|
||||
|
||||
ev
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
{
|
||||
if let Some(trickmode_interval) = s.trickmode_interval {
|
||||
gst_sys::gst_event_set_seek_trickmode_interval(
|
||||
ev,
|
||||
trickmode_interval.to_glib(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ev
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,12 @@ pub fn calculate_linear_regression(
|
|||
unsafe {
|
||||
assert_eq!(mem::size_of::<u64>() * 2, mem::size_of::<(u64, u64)>());
|
||||
assert_eq!(mem::align_of::<u64>(), mem::align_of::<(u64, u64)>());
|
||||
assert!(temp.as_ref().map(|temp| temp.len()).unwrap_or(xy.len()) >= xy.len());
|
||||
assert!(
|
||||
temp.as_ref()
|
||||
.map(|temp| temp.len())
|
||||
.unwrap_or_else(|| xy.len())
|
||||
>= xy.len()
|
||||
);
|
||||
|
||||
let mut m_num = mem::MaybeUninit::uninit();
|
||||
let mut m_denom = mem::MaybeUninit::uninit();
|
||||
|
|
Loading…
Reference in a new issue