Fix various new clippy 1.89 warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2436>
This commit is contained in:
Sebastian Dröge 2025-08-07 15:06:24 +03:00 committed by GStreamer Marge Bot
parent 4e7d42c16e
commit a8be57a742
6 changed files with 18 additions and 19 deletions

View file

@ -1246,7 +1246,7 @@ fn test_taic_stai_encode(video_enc: &str, enabled: bool) {
let stbl = &moov.trak.first().unwrap().mdia.minf.stbl; let stbl = &moov.trak.first().unwrap().mdia.minf.stbl;
let saio = stbl.saio.as_ref().unwrap(); let saio = stbl.saio.as_ref().unwrap();
let saiz = stbl.saiz.as_ref().unwrap(); let saiz = stbl.saiz.as_ref().unwrap();
if mdat_data.is_some() { if let Some(ref mdat_data) = mdat_data {
assert_eq!( assert_eq!(
saio.aux_info.as_ref().unwrap().aux_info_type, saio.aux_info.as_ref().unwrap().aux_info_type,
b"stai".into() b"stai".into()
@ -1262,18 +1262,16 @@ fn test_taic_stai_encode(video_enc: &str, enabled: bool) {
let len = saiz.default_sample_info_size as u64; let len = saiz.default_sample_info_size as u64;
let offset_into_mdat_start = (offset - mdat_offset) as usize; let offset_into_mdat_start = (offset - mdat_offset) as usize;
let offset_into_mdat_end = offset_into_mdat_start + len as usize; let offset_into_mdat_end = offset_into_mdat_start + len as usize;
let vec = &mdat_data.as_ref().unwrap() let slice = &mdat_data[offset_into_mdat_start..offset_into_mdat_end];
[offset_into_mdat_start..offset_into_mdat_end] assert_eq!(slice.len(), 9);
.to_vec();
assert_eq!(vec.len(), 9);
let mut timestamp_bytes: [u8; 8] = [0; 8]; let mut timestamp_bytes: [u8; 8] = [0; 8];
timestamp_bytes.copy_from_slice(&vec.as_slice()[0..8]); timestamp_bytes.copy_from_slice(&slice[0..8]);
let timestamp = u64::from_be_bytes(timestamp_bytes); let timestamp = u64::from_be_bytes(timestamp_bytes);
assert_eq!( assert_eq!(
timestamp, timestamp,
tai_nanos_initial_offset + (i as u64) * tai_nanos_per_frame_step tai_nanos_initial_offset + (i as u64) * tai_nanos_per_frame_step
); );
assert_eq!(vec[8], 0x80); assert_eq!(slice[8], 0x80);
} }
} else { } else {
panic!("mdat should not be none"); panic!("mdat should not be none");

View file

@ -15,6 +15,7 @@
use gst::glib; use gst::glib;
use gst::prelude::*; use gst::prelude::*;
#[allow(unused)]
mod cros_codecs; mod cros_codecs;
mod imp; mod imp;

View file

@ -631,7 +631,7 @@ impl VideoFrame {
} }
#[cfg(feature = "advanced-sdk")] #[cfg(feature = "advanced-sdk")]
pub fn compressed_packet(&self) -> Option<CompressedPacket> { pub fn compressed_packet(&self) -> Option<CompressedPacket<'_>> {
use byteorder::{LittleEndian, ReadBytesExt}; use byteorder::{LittleEndian, ReadBytesExt};
use std::io::Cursor; use std::io::Cursor;
use std::slice; use std::slice;
@ -987,7 +987,7 @@ impl AudioFrame {
} }
#[cfg(feature = "advanced-sdk")] #[cfg(feature = "advanced-sdk")]
pub fn compressed_packet(&self) -> Option<CompressedPacket> { pub fn compressed_packet(&self) -> Option<CompressedPacket<'_>> {
use byteorder::{LittleEndian, ReadBytesExt}; use byteorder::{LittleEndian, ReadBytesExt};
use std::io::Cursor; use std::io::Cursor;
use std::slice; use std::slice;

View file

@ -142,7 +142,7 @@ impl State {
fn line( fn line(
&mut self, &mut self,
drain: bool, drain: bool,
) -> Result<Option<MccLine>, (&[u8], winnow::error::ContextError)> { ) -> Result<Option<MccLine<'_>>, (&[u8], winnow::error::ContextError)> {
let line = if self.replay_last_line { let line = if self.replay_last_line {
self.replay_last_line = false; self.replay_last_line = false;
&self.last_raw_line &self.last_raw_line
@ -466,8 +466,8 @@ impl MccParse {
fn handle_skipped_line( fn handle_skipped_line(
&self, &self,
tc: TimeCode, tc: TimeCode,
mut state: MutexGuard<State>, mut state: MutexGuard<'_, State>,
) -> Result<MutexGuard<State>, gst::FlowError> { ) -> Result<MutexGuard<'_, State>, gst::FlowError> {
let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)?; let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)?;
let timecode = state.handle_timecode(self, framerate, drop_frame, tc)?; let timecode = state.handle_timecode(self, framerate, drop_frame, tc)?;
let nsecs = timecode.time_since_daily_jam(); let nsecs = timecode.time_since_daily_jam();
@ -495,8 +495,8 @@ impl MccParse {
tc: TimeCode, tc: TimeCode,
data: Vec<u8>, data: Vec<u8>,
format: Format, format: Format,
mut state: MutexGuard<State>, mut state: MutexGuard<'_, State>,
) -> Result<MutexGuard<State>, gst::FlowError> { ) -> Result<MutexGuard<'_, State>, gst::FlowError> {
let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)?; let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)?;
let events = state.create_events(self, Some(format), framerate); let events = state.create_events(self, Some(format), framerate);
let timecode = state.handle_timecode(self, framerate, drop_frame, tc)?; let timecode = state.handle_timecode(self, framerate, drop_frame, tc)?;
@ -829,7 +829,7 @@ impl MccParse {
self.handle_buffer(Some(buffer), false) self.handle_buffer(Some(buffer), false)
} }
fn flush(&self, mut state: MutexGuard<State>) -> MutexGuard<State> { fn flush(&self, mut state: MutexGuard<'_, State>) -> MutexGuard<'_, State> {
state.reader.clear(); state.reader.clear();
state.parser.reset(); state.parser.reset();
if let Some(pull) = &mut state.pull { if let Some(pull) = &mut state.pull {

View file

@ -325,8 +325,8 @@ impl SccParse {
&self, &self,
tc: TimeCode, tc: TimeCode,
data: Vec<u8>, data: Vec<u8>,
mut state: MutexGuard<State>, mut state: MutexGuard<'_, State>,
) -> Result<MutexGuard<State>, gst::FlowError> { ) -> Result<MutexGuard<'_, State>, gst::FlowError> {
gst::trace!( gst::trace!(
CAT, CAT,
imp = self, imp = self,
@ -732,7 +732,7 @@ impl SccParse {
self.handle_buffer(Some(buffer)) self.handle_buffer(Some(buffer))
} }
fn flush(&self, mut state: MutexGuard<State>) -> MutexGuard<State> { fn flush(&self, mut state: MutexGuard<'_, State>) -> MutexGuard<'_, State> {
state.reader.clear(); state.reader.clear();
state.parser.reset(); state.parser.reset();
if let Some(pull) = &mut state.pull { if let Some(pull) = &mut state.pull {

View file

@ -96,7 +96,7 @@ impl Decoder<'_> {
} }
} }
fn next(&mut self) -> Option<Frame> { fn next(&mut self) -> Option<Frame<'_>> {
let mut buf = std::ptr::null_mut(); let mut buf = std::ptr::null_mut();
let buf_ptr: *mut *mut u8 = &mut buf; let buf_ptr: *mut *mut u8 = &mut buf;
let mut timestamp: i32 = 0; let mut timestamp: i32 = 0;