diff --git a/audio/audiofx/src/audioecho/ring_buffer.rs b/audio/audiofx/src/audioecho/ring_buffer.rs index 7e811744..fc4265f4 100644 --- a/audio/audiofx/src/audioecho/ring_buffer.rs +++ b/audio/audiofx/src/audioecho/ring_buffer.rs @@ -77,7 +77,7 @@ impl<'a> Iterator for RingBufferIter<'a> { } } -impl<'a> Drop for RingBufferIter<'a> { +impl Drop for RingBufferIter<'_> { fn drop(&mut self) { *self.buffer_pos = self.write_pos; } diff --git a/generic/originalbuffer/src/originalbuffermeta.rs b/generic/originalbuffer/src/originalbuffermeta.rs index d6a6a3a9..30e00ea7 100644 --- a/generic/originalbuffer/src/originalbuffermeta.rs +++ b/generic/originalbuffer/src/originalbuffermeta.rs @@ -90,7 +90,7 @@ mod imp { pub(super) fn original_buffer_meta_api_get_type() -> glib::Type { static TYPE: LazyLock = LazyLock::new(|| unsafe { let t = from_glib(gst::ffi::gst_meta_api_type_register( - b"GstOriginalBufferMetaAPI\0".as_ptr() as *const _, + c"GstOriginalBufferMetaAPI".as_ptr() as *const _, [ptr::null::()].as_ptr() as *mut *const _, )); @@ -161,7 +161,7 @@ mod imp { MetaInfo( ptr::NonNull::new(gst::ffi::gst_meta_register( original_buffer_meta_api_get_type().into_glib(), - b"OriginalBufferMeta\0".as_ptr() as *const _, + c"OriginalBufferMeta".as_ptr() as *const _, mem::size_of::(), Some(original_buffer_meta_init), Some(original_buffer_meta_free), diff --git a/generic/sodium/src/encrypter/imp.rs b/generic/sodium/src/encrypter/imp.rs index bc79f8c2..0bff06ac 100644 --- a/generic/sodium/src/encrypter/imp.rs +++ b/generic/sodium/src/encrypter/imp.rs @@ -303,7 +303,7 @@ impl Encrypter { }; // calculate the number of chunks that exist in the stream - let total_chunks = (size + state.block_size as u64 - 1) / state.block_size as u64; + let total_chunks = size.div_ceil(state.block_size as u64); // add the MAC of each block let size = size + total_chunks * box_::MACBYTES as u64; diff --git a/generic/streamgrouper/src/streamgrouper/imp.rs b/generic/streamgrouper/src/streamgrouper/imp.rs index 3ac91144..82aa18a4 100644 --- a/generic/streamgrouper/src/streamgrouper/imp.rs +++ b/generic/streamgrouper/src/streamgrouper/imp.rs @@ -65,10 +65,8 @@ impl State { use std::collections::btree_map::Entry::{Occupied, Vacant}; match self.streams_by_number.entry(number) { Occupied(_) => panic!("Stream {number} already exists!"), - Vacant(entry) => { - return entry.insert(stream); - } - }; + Vacant(entry) => entry.insert(stream), + } } fn remove_stream_or_panic(&mut self, number: usize) { diff --git a/generic/threadshare/src/lib.rs b/generic/threadshare/src/lib.rs index 808fb29b..ec0128d4 100644 --- a/generic/threadshare/src/lib.rs +++ b/generic/threadshare/src/lib.rs @@ -6,13 +6,11 @@ //! A collection of GStreamer plugins which leverage the `threadshare` [`runtime`]. //! //! [`runtime`]: runtime/index.html - /** * plugin-threadshare: * * Since: plugins-rs-0.4.0 */ - #[macro_use] pub mod runtime; diff --git a/generic/threadshare/src/runtime/pad.rs b/generic/threadshare/src/runtime/pad.rs index 0ec692b7..1acec6a3 100644 --- a/generic/threadshare/src/runtime/pad.rs +++ b/generic/threadshare/src/runtime/pad.rs @@ -318,7 +318,7 @@ pub struct PadSrcRef<'a> { phantom: PhantomData<&'a Self>, } -impl<'a> PadSrcRef<'a> { +impl PadSrcRef<'_> { fn new(inner_arc: Arc) -> Self { PadSrcRef { strong: inner_arc, @@ -331,7 +331,7 @@ impl<'a> PadSrcRef<'a> { } } -impl<'a> Deref for PadSrcRef<'a> { +impl Deref for PadSrcRef<'_> { type Target = PadSrcInner; fn deref(&self) -> &Self::Target { @@ -712,7 +712,7 @@ pub struct PadSinkRef<'a> { phantom: PhantomData<&'a Self>, } -impl<'a> PadSinkRef<'a> { +impl PadSinkRef<'_> { fn new(inner_arc: Arc) -> Self { PadSinkRef { strong: inner_arc, @@ -725,7 +725,7 @@ impl<'a> PadSinkRef<'a> { } } -impl<'a> Deref for PadSinkRef<'a> { +impl Deref for PadSinkRef<'_> { type Target = PadSinkInner; fn deref(&self) -> &Self::Target { diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs index ce6a12d3..5c2885ff 100644 --- a/mux/fmp4/src/fmp4mux/imp.rs +++ b/mux/fmp4/src/fmp4mux/imp.rs @@ -1324,10 +1324,10 @@ impl FMP4Mux { let fragment_end_pts = fragment_start_pts + settings.fragment_duration; // If we have a manual fragment boundary set then use that - return *manual_fragment_boundaries + *manual_fragment_boundaries .range((Excluded(fragment_start_pts), Excluded(fragment_end_pts))) .next() - .unwrap_or(&fragment_end_pts); + .unwrap_or(&fragment_end_pts) } /// Check if the stream is filled enough for the current chunk / fragment. diff --git a/net/ndi/src/lib.rs b/net/ndi/src/lib.rs index 247dc0b4..881fa6d5 100644 --- a/net/ndi/src/lib.rs +++ b/net/ndi/src/lib.rs @@ -6,7 +6,6 @@ * * Since: plugins-rs-0.9 */ - #[allow(dead_code)] mod ndi; #[allow(dead_code)] diff --git a/net/ndi/src/ndi.rs b/net/ndi/src/ndi.rs index 0ea4d026..d008a9fb 100644 --- a/net/ndi/src/ndi.rs +++ b/net/ndi/src/ndi.rs @@ -23,7 +23,7 @@ pub struct FindBuilder<'a> { extra_ips: Option<&'a str>, } -impl<'a> Default for FindBuilder<'a> { +impl Default for FindBuilder<'_> { fn default() -> Self { Self { show_local_sources: true, @@ -129,10 +129,10 @@ pub enum Source<'a> { Owned(NDIlib_source_t, ffi::CString, ffi::CString), } -unsafe impl<'a> Send for Source<'a> {} -unsafe impl<'a> Sync for Source<'a> {} +unsafe impl Send for Source<'_> {} +unsafe impl Sync for Source<'_> {} -impl<'a> Source<'a> { +impl Source<'_> { pub fn ndi_name(&self) -> &str { unsafe { let ptr = match *self { @@ -198,7 +198,7 @@ pub struct RecvBuilder<'a> { ndi_recv_name: &'a str, } -impl<'a> RecvBuilder<'a> { +impl RecvBuilder<'_> { pub fn allow_video_fields(self, allow_video_fields: bool) -> Self { Self { allow_video_fields, @@ -362,7 +362,7 @@ pub struct SendBuilder<'a> { clock_video: bool, } -impl<'a> SendBuilder<'a> { +impl SendBuilder<'_> { pub fn clock_audio(self) -> Self { Self { clock_audio: true, diff --git a/net/ndi/src/ndisinkmeta.rs b/net/ndi/src/ndisinkmeta.rs index 5a5a573b..f14f174a 100644 --- a/net/ndi/src/ndisinkmeta.rs +++ b/net/ndi/src/ndisinkmeta.rs @@ -70,7 +70,7 @@ mod imp { pub(super) fn ndi_sink_audio_meta_api_get_type() -> glib::Type { static TYPE: LazyLock = LazyLock::new(|| unsafe { let t = from_glib(gst::ffi::gst_meta_api_type_register( - b"GstNdiSinkAudioMetaAPI\0".as_ptr() as *const _, + c"GstNdiSinkAudioMetaAPI".as_ptr() as *const _, [ptr::null::()].as_ptr() as *mut *const _, )); @@ -129,7 +129,7 @@ mod imp { MetaInfo( ptr::NonNull::new(gst::ffi::gst_meta_register( ndi_sink_audio_meta_api_get_type().into_glib(), - b"GstNdiSinkAudioMeta\0".as_ptr() as *const _, + c"GstNdiSinkAudioMeta".as_ptr() as *const _, mem::size_of::(), Some(ndi_sink_audio_meta_init), Some(ndi_sink_audio_meta_free), diff --git a/net/ndi/src/ndisrcmeta.rs b/net/ndi/src/ndisrcmeta.rs index db613500..72ed6fe1 100644 --- a/net/ndi/src/ndisrcmeta.rs +++ b/net/ndi/src/ndisrcmeta.rs @@ -95,7 +95,7 @@ mod imp { pub(super) fn ndi_src_meta_api_get_type() -> glib::Type { static TYPE: LazyLock = LazyLock::new(|| unsafe { let t = from_glib(gst::ffi::gst_meta_api_type_register( - b"GstNdiSrcMetaAPI\0".as_ptr() as *const _, + c"GstNdiSrcMetaAPI".as_ptr() as *const _, [ptr::null::()].as_ptr() as *mut *const _, )); @@ -150,7 +150,7 @@ mod imp { MetaInfo( ptr::NonNull::new(gst::ffi::gst_meta_register( ndi_src_meta_api_get_type().into_glib(), - b"GstNdiSrcMeta\0".as_ptr() as *const _, + c"GstNdiSrcMeta".as_ptr() as *const _, mem::size_of::(), Some(ndi_src_meta_init), Some(ndi_src_meta_free), diff --git a/net/quinn/src/quinnquicmeta/mod.rs b/net/quinn/src/quinnquicmeta/mod.rs index 0539242d..967f396d 100644 --- a/net/quinn/src/quinnquicmeta/mod.rs +++ b/net/quinn/src/quinnquicmeta/mod.rs @@ -81,7 +81,7 @@ mod imp { *TYPE.get_or_init(|| unsafe { let t = glib::Type::from_glib(gst::ffi::gst_meta_api_type_register( - b"QuinnQuicMetaAPI\0".as_ptr() as *const _, + c"QuinnQuicMetaAPI".as_ptr() as *const _, [ptr::null::()].as_ptr() as *mut *const _, )); @@ -147,7 +147,7 @@ mod imp { MetaInfo( ptr::NonNull::new(gst::ffi::gst_meta_register( custom_meta_api_get_type().into_glib(), - b"QuinnQuicMeta\0".as_ptr() as *const _, + c"QuinnQuicMeta".as_ptr() as *const _, mem::size_of::(), Some(custom_meta_init), Some(custom_meta_free), diff --git a/net/raptorq/src/raptorqenc/imp.rs b/net/raptorq/src/raptorqenc/imp.rs index d374e036..fd4e1007 100644 --- a/net/raptorq/src/raptorqenc/imp.rs +++ b/net/raptorq/src/raptorqenc/imp.rs @@ -576,7 +576,7 @@ impl RaptorqEnc { // it SHALL be the same for all repair packets in a block. This include // 1 byte of flow indication and 2 bytes of length indication as defined // in RFC6881, section 8.2.4. - let symbols_per_packet = (mtu + 3 + symbol_size - 1) / symbol_size; + let symbols_per_packet = (mtu + 3).div_ceil(symbol_size); let symbols_per_block = symbols_per_packet * protected_packets_num; if symbol_size.rem_euclid(SYMBOL_ALIGNMENT) != 0 { diff --git a/net/rtp/src/ac3/pay/imp.rs b/net/rtp/src/ac3/pay/imp.rs index b6339d8b..eee988a8 100644 --- a/net/rtp/src/ac3/pay/imp.rs +++ b/net/rtp/src/ac3/pay/imp.rs @@ -530,7 +530,7 @@ impl RtpAc3Pay { }; // The number fragments (and therefore packets) that make up the current frame - let n = (first.header.frame_len + max_payload_size - 1) / max_payload_size; + let n = first.header.frame_len.div_ceil(max_payload_size); let ac3_specific_header = ((frame_type << 8) | (n as u16)).to_be_bytes(); diff --git a/net/rtp/src/jpeg/header.rs b/net/rtp/src/jpeg/header.rs index f7839580..48b91ba0 100644 --- a/net/rtp/src/jpeg/header.rs +++ b/net/rtp/src/jpeg/header.rs @@ -151,7 +151,7 @@ impl FromByteStream for RestartHeader { } } -impl<'a> ToByteStreamWith<'a> for RestartHeader { +impl ToByteStreamWith<'_> for RestartHeader { type Error = anyhow::Error; type Context = MainHeader; @@ -216,7 +216,7 @@ impl Default for QuantizationTableHeader { } } -impl<'a> FromByteStreamWith<'a> for QuantizationTableHeader { +impl FromByteStreamWith<'_> for QuantizationTableHeader { type Error = anyhow::Error; type Context = MainHeader; @@ -267,7 +267,7 @@ impl<'a> FromByteStreamWith<'a> for QuantizationTableHeader { } } -impl<'a> ToByteStreamWith<'a> for QuantizationTableHeader { +impl ToByteStreamWith<'_> for QuantizationTableHeader { type Error = anyhow::Error; type Context = MainHeader; diff --git a/net/rtp/src/lib.rs b/net/rtp/src/lib.rs index d3b0fb30..4c6a2b81 100644 --- a/net/rtp/src/lib.rs +++ b/net/rtp/src/lib.rs @@ -14,7 +14,6 @@ * * Since: plugins-rs-0.9.0 */ - #[macro_use] extern crate log; diff --git a/net/rtp/src/mp4a/parsers.rs b/net/rtp/src/mp4a/parsers.rs index 3b2246fe..3d864801 100644 --- a/net/rtp/src/mp4a/parsers.rs +++ b/net/rtp/src/mp4a/parsers.rs @@ -265,7 +265,7 @@ impl<'a> Subframes<'a> { } } -impl<'a> Iterator for Subframes<'a> { +impl Iterator for Subframes<'_> { type Item = Result; fn next(&mut self) -> Option { diff --git a/net/rtp/src/mp4g/depay/parsers.rs b/net/rtp/src/mp4g/depay/parsers.rs index 42b74f0c..91097c1e 100644 --- a/net/rtp/src/mp4g/depay/parsers.rs +++ b/net/rtp/src/mp4g/depay/parsers.rs @@ -159,7 +159,7 @@ pub struct AccessUnitIter<'a> { cur: u32, } -impl<'a> Iterator for AccessUnitIter<'a> { +impl Iterator for AccessUnitIter<'_> { type Item = anyhow::Result; fn next(&mut self) -> Option { @@ -172,7 +172,7 @@ impl<'a> Iterator for AccessUnitIter<'a> { } } -impl<'a> AccessUnitIter<'a> { +impl AccessUnitIter<'_> { fn next_priv(&mut self) -> Option> { use Mpeg4GenericDepayError::*; diff --git a/net/rtp/src/mp4g/tests.rs b/net/rtp/src/mp4g/tests.rs index dca93c65..85cfcbad 100644 --- a/net/rtp/src/mp4g/tests.rs +++ b/net/rtp/src/mp4g/tests.rs @@ -240,7 +240,7 @@ fn generic_fragmented() { const BUFFER_SIZE: usize = 2000; const MTU: usize = 1400; // Enough overhead in the MTU to use this approximation: - const FRAGMENTS_PER_BUFFER: usize = (BUFFER_SIZE + MTU - 1) / MTU; + const FRAGMENTS_PER_BUFFER: usize = BUFFER_SIZE.div_ceil(MTU); const RTP_CLOCK_RATE: u64 = 90_000; const LAST_FRAGMENT: usize = FRAGMENTS_PER_BUFFER - 1; const FRAME_RATE: u64 = 30; @@ -357,7 +357,7 @@ fn generic_variable_au_size() { const AU_NB: usize = 5; const SMALL_AU_SIZE: usize = 500; const LARGE_AU_SIZE: usize = 2000; - const FRAGMENTS_PER_LARGE_BUFFER: usize = (LARGE_AU_SIZE + MTU - 1) / MTU; + const FRAGMENTS_PER_LARGE_BUFFER: usize = LARGE_AU_SIZE.div_ceil(MTU); const LAST_FRAGMENT: usize = FRAGMENTS_PER_LARGE_BUFFER - 1; const RTP_CLOCK_RATE: u64 = 90_000; const FRAME_RATE: u64 = 30; diff --git a/net/rtp/src/rtpbin2/source.rs b/net/rtp/src/rtpbin2/source.rs index d636dafe..b802ab61 100644 --- a/net/rtp/src/rtpbin2/source.rs +++ b/net/rtp/src/rtpbin2/source.rs @@ -70,7 +70,7 @@ impl Rb { } } -impl<'a> From> for Rb { +impl From> for Rb { fn from(value: ReportBlock) -> Self { Self { ssrc: value.ssrc(), diff --git a/net/rtp/src/vp8/frame_header.rs b/net/rtp/src/vp8/frame_header.rs index c3849afd..135ab1b4 100644 --- a/net/rtp/src/vp8/frame_header.rs +++ b/net/rtp/src/vp8/frame_header.rs @@ -117,7 +117,7 @@ trait BitReadExt: BitRead { impl BitReadExt for T {} -impl<'a> FromBitStreamWith<'a> for FrameHeader { +impl FromBitStreamWith<'_> for FrameHeader { type Error = anyhow::Error; /// Keyframe? type Context = bool; diff --git a/net/rtp/src/vp9/frame_header.rs b/net/rtp/src/vp9/frame_header.rs index 905ca0db..ecf20299 100644 --- a/net/rtp/src/vp9/frame_header.rs +++ b/net/rtp/src/vp9/frame_header.rs @@ -98,7 +98,7 @@ pub struct KeyframeInfo { pub render_size: Option<(u32, u32)>, } -impl<'a> FromBitStreamWith<'a> for KeyframeInfo { +impl FromBitStreamWith<'_> for KeyframeInfo { type Error = anyhow::Error; /// Profile @@ -173,7 +173,7 @@ pub struct ColorConfig { pub sub_sampling_y: u8, } -impl<'a> FromBitStreamWith<'a> for ColorConfig { +impl FromBitStreamWith<'_> for ColorConfig { type Error = anyhow::Error; /// Profile diff --git a/net/rtp/src/vp9/payload_descriptor.rs b/net/rtp/src/vp9/payload_descriptor.rs index 81b944b9..b77c5905 100644 --- a/net/rtp/src/vp9/payload_descriptor.rs +++ b/net/rtp/src/vp9/payload_descriptor.rs @@ -310,7 +310,7 @@ pub struct LayerIndex { pub temporal_layer_zero_index: Option, } -impl<'a> FromByteStreamWith<'a> for LayerIndex { +impl FromByteStreamWith<'_> for LayerIndex { type Error = anyhow::Error; /// Flexible mode? type Context = bool; @@ -345,7 +345,7 @@ impl<'a> FromByteStreamWith<'a> for LayerIndex { } } -impl<'a> ToByteStreamWith<'a> for LayerIndex { +impl ToByteStreamWith<'_> for LayerIndex { type Error = anyhow::Error; /// Flexible mode? diff --git a/net/webrtc/src/webrtcsink/mod.rs b/net/webrtc/src/webrtcsink/mod.rs index e2c0128e..6a17f0f7 100644 --- a/net/webrtc/src/webrtcsink/mod.rs +++ b/net/webrtc/src/webrtcsink/mod.rs @@ -18,14 +18,12 @@ use crate::signaller::Signallable; * See the [documentation of the plugin](plugin-rswebrtc) for more information * on features and usage. */ - /** * GstBaseWebRTCSink: * @title: Base class for WebRTC producers * * Base class for WebRTC sinks to implement and provide their own protocol for. */ - /** * GstRSWebRTCSignallableIface: * @title: Interface for WebRTC signalling protocols diff --git a/video/dav1d/src/dav1ddec/imp.rs b/video/dav1d/src/dav1ddec/imp.rs index 5dfe0096..8495ad9e 100644 --- a/video/dav1d/src/dav1ddec/imp.rs +++ b/video/dav1d/src/dav1ddec/imp.rs @@ -604,7 +604,7 @@ impl Dav1dDec { &'s self, mut state_guard: MutexGuard<'s, Option>, drain: bool, - ) -> Result>, gst::FlowError> { + ) -> Result>, gst::FlowError> { // dav1d wants to have get_picture() called a second time after it return EAGAIN to // actually drain all pending pictures. let mut call_twice = drain; diff --git a/video/webp/src/dec/imp.rs b/video/webp/src/dec/imp.rs index 48fc9000..5a758468 100644 --- a/video/webp/src/dec/imp.rs +++ b/video/webp/src/dec/imp.rs @@ -47,8 +47,8 @@ struct Info { frame_count: u32, } -impl<'a> Decoder<'_> { - fn from_data(data: &'a [u8]) -> Option { +impl Decoder<'_> { + fn from_data(data: &[u8]) -> Option { unsafe { let mut options = std::mem::MaybeUninit::zeroed(); if ffi::WebPAnimDecoderOptionsInit(options.as_mut_ptr()) == 0 {