Fix or silence various new clippy warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2253>
This commit is contained in:
Sebastian Dröge 2025-05-21 14:33:22 +03:00
parent 6450381017
commit 860bebcdef
8 changed files with 15 additions and 23 deletions

View file

@ -15,7 +15,7 @@ use gst_base::subclass::prelude::*;
use hrtf::{HrirSphere, HrtfContext, HrtfProcessor, Vec3};
use std::io::{Error, ErrorKind};
use std::io::Error;
use std::path::PathBuf;
use std::sync::{Arc, Mutex, Weak};
@ -161,7 +161,7 @@ impl Settings {
return HrirSphere::from_file(PathBuf::from(path), rate);
}
Err(Error::new(ErrorKind::Other, "Impulse response not set").into())
Err(Error::other("Impulse response not set").into())
}
}

View file

@ -106,6 +106,7 @@ impl PartialEq for GapPacket {
}
}
#[derive(Default)]
struct SinkHandlerInner {
packet_rate_ctx: RTPPacketRateCtx,
ips_rtptime: Option<u32>,
@ -119,20 +120,6 @@ struct SinkHandlerInner {
last_rtptime: Option<u32>,
}
impl Default for SinkHandlerInner {
fn default() -> Self {
SinkHandlerInner {
packet_rate_ctx: RTPPacketRateCtx::new(),
ips_rtptime: None,
ips_pts: None,
gap_packets: BTreeSet::new(),
last_pt: None,
last_in_seqnum: None,
last_rtptime: None,
}
}
}
#[derive(Clone, Default)]
struct SinkHandler(Arc<StdMutex<SinkHandlerInner>>);

View file

@ -471,11 +471,7 @@ impl FlvDemux {
}
};
let skip = if header.offset < 9 {
0
} else {
header.offset - 9
};
let skip = header.offset.saturating_sub(9);
*state = State::Skipping {
audio: header.audio,

View file

@ -463,6 +463,7 @@ impl Tally {
}
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum Frame {
Video(VideoFrame),
Audio(AudioFrame),
@ -473,6 +474,7 @@ pub enum Frame {
pub struct VideoFrame(VideoFrameInner);
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
enum VideoFrameInner {
//Owned(NDIlib_video_frame_v2_t, Option<ffi::CString>, Option<Vec<u8>>),
BorrowedRecv(NDIlib_video_frame_v2_t, Arc<RecvInstancePtr>),

View file

@ -526,7 +526,7 @@ impl Detector {
"Packet group done: {:?}",
gst::ClockTime::from_nseconds(group.departure.whole_nanoseconds() as u64)
);
if let Some(prev_group) = mem::replace(&mut self.prev_group, Some(group.clone())) {
if let Some(prev_group) = self.prev_group.replace(group.clone()) {
// 5.3 Arrival-time filter
self.estimator_impl.update(&prev_group, &group);
// 5.4 Over-use detector

View file

@ -341,7 +341,7 @@ impl RtpSend {
loop {
match session_inner.session.handle_send(&rtp, now) {
SendReply::SsrcCollision(ssrc) => {
if !ssrc_collision.iter().any(|&needle| needle == ssrc) {
if !ssrc_collision.contains(&ssrc) {
ssrc_collision.push(ssrc);
}
}

View file

@ -130,6 +130,7 @@ pub struct RtspSrc {
}
#[derive(thiserror::Error, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum RtspError {
#[error("Generic I/O error")]
IOGeneric(#[from] std::io::Error),
@ -1245,6 +1246,7 @@ impl RtspTaskState {
}
}
#[allow(clippy::result_large_err)]
fn check_response(
rsp: &Response<Body>,
cseq: u32,
@ -1391,6 +1393,7 @@ impl RtspTaskState {
Ok(())
}
#[allow(clippy::result_large_err)]
fn parse_setup_transports(
transports: &Transports,
s: &mut gst::Structure,

View file

@ -188,6 +188,7 @@ pub fn parse_control_path(path: &str, base: &Url) -> Option<Url> {
}
}
#[allow(clippy::result_large_err)]
fn parse_rtpmap(
rtpmap: &str,
pt: u8,
@ -243,6 +244,7 @@ fn parse_rtpmap(
Ok(())
}
#[allow(clippy::result_large_err)]
fn guess_rtpmap_from_encoding_name(
encoding_name: &str,
media: &str,
@ -268,6 +270,7 @@ fn guess_rtpmap_from_encoding_name(
)))
}
#[allow(clippy::result_large_err)]
fn guess_rtpmap_from_pt(
pt: u8,
media: &str,
@ -355,6 +358,7 @@ fn parse_framesize(framesize: &str, s: &mut gst::structure::Structure) {
s.set("a-framesize", dim);
}
#[allow(clippy::result_large_err)]
pub fn parse_media_attributes(
attrs: &Vec<Attribute>,
pt: u8,