mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +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'
|
extends: '.tarball_setup'
|
||||||
image: "rust:slim"
|
image: "rust:slim"
|
||||||
stage: 'extras'
|
stage: 'extras'
|
||||||
allow_failure: true
|
|
||||||
script:
|
script:
|
||||||
- rustup component add clippy-preview
|
- rustup component add clippy-preview
|
||||||
- cargo clippy --version
|
- cargo clippy --version
|
||||||
|
@ -141,5 +140,9 @@ clippy:
|
||||||
FEATURES=v1_16
|
FEATURES=v1_16
|
||||||
fi
|
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
|
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,
|
gst_gl::GLPlatform::GLX,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
handler => panic!("Unsupported platform: {:?}.", handler),
|
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::too_many_arguments)]
|
||||||
#[allow(clippy::match_same_arms)]
|
#[allow(clippy::match_same_arms)]
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
|
#[allow(clippy::let_and_return)]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::*;
|
pub use auto::*;
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,7 @@ impl VideoFormatInfo {
|
||||||
(-((-(i64::from(height))) >> self.h_sub()[component as usize])) as u32
|
(-((-(i64::from(height))) >> self.h_sub()[component as usize])) as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn unpack(
|
pub fn unpack(
|
||||||
&self,
|
&self,
|
||||||
flags: ::VideoPackFlags,
|
flags: ::VideoPackFlags,
|
||||||
|
@ -220,6 +221,7 @@ impl VideoFormatInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn pack(
|
pub fn pack(
|
||||||
&self,
|
&self,
|
||||||
flags: ::VideoPackFlags,
|
flags: ::VideoPackFlags,
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl TryFrom<DateTimeVariants> for Date {
|
||||||
impl<'de> Deserialize<'de> for Date {
|
impl<'de> Deserialize<'de> for Date {
|
||||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
DateTimeVariants::deserialize(deserializer)
|
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,6 +1410,8 @@ impl<'a> SeekBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
event_builder_generic_impl!(|s: &Self| {
|
event_builder_generic_impl!(|s: &Self| {
|
||||||
|
#[allow(clippy::let_and_return)]
|
||||||
|
{
|
||||||
let ev = gst_sys::gst_event_new_seek(
|
let ev = gst_sys::gst_event_new_seek(
|
||||||
s.rate,
|
s.rate,
|
||||||
s.start.get_format().to_glib(),
|
s.start.get_format().to_glib(),
|
||||||
|
@ -1423,11 +1425,15 @@ impl<'a> SeekBuilder<'a> {
|
||||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||||
{
|
{
|
||||||
if let Some(trickmode_interval) = s.trickmode_interval {
|
if let Some(trickmode_interval) = s.trickmode_interval {
|
||||||
gst_sys::gst_event_set_seek_trickmode_interval(ev, trickmode_interval.to_glib());
|
gst_sys::gst_event_set_seek_trickmode_interval(
|
||||||
|
ev,
|
||||||
|
trickmode_interval.to_glib(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ev
|
ev
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,12 @@ pub fn calculate_linear_regression(
|
||||||
unsafe {
|
unsafe {
|
||||||
assert_eq!(mem::size_of::<u64>() * 2, mem::size_of::<(u64, u64)>());
|
assert_eq!(mem::size_of::<u64>() * 2, mem::size_of::<(u64, u64)>());
|
||||||
assert_eq!(mem::align_of::<u64>(), mem::align_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_num = mem::MaybeUninit::uninit();
|
||||||
let mut m_denom = mem::MaybeUninit::uninit();
|
let mut m_denom = mem::MaybeUninit::uninit();
|
||||||
|
|
Loading…
Reference in a new issue