Fix various new Rust 1.85 clippy warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2104>
This commit is contained in:
Sebastian Dröge 2025-02-21 11:13:24 +02:00
parent 4fdcba449e
commit 93ee2ee70d
7 changed files with 14 additions and 14 deletions

View file

@ -1336,7 +1336,7 @@ fn write_audio_sample_entry(
(bitrate / 8000) as u16
}
"audio/x-flac" => with_flac_metadata(&stream.caps, |streaminfo, _| {
1 + (u16::from_be_bytes([streaminfo[16], streaminfo[17]]) >> 4 & 0b11111)
1 + ((u16::from_be_bytes([streaminfo[16], streaminfo[17]]) >> 4) & 0b11111)
})
.context("FLAC metadata error")?,
_ => 16u16,

View file

@ -1613,7 +1613,7 @@ fn write_audio_sample_entry(
(bitrate / 8000) as u16
}
"audio/x-flac" => with_flac_metadata(&stream.caps, |streaminfo, _| {
1 + (u16::from_be_bytes([streaminfo[16], streaminfo[17]]) >> 4 & 0b11111)
1 + ((u16::from_be_bytes([streaminfo[16], streaminfo[17]]) >> 4) & 0b11111)
})
.context("FLAC metadata error")?,
_ => 16u16,

View file

@ -307,7 +307,7 @@ pub struct NDIlib_audio_frame_v3_t {
}
#[cfg(feature = "advanced-sdk")]
#[repr(packed)]
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
pub struct NDIlib_compressed_packet_t {
pub version: u32,

View file

@ -171,11 +171,11 @@ pub fn set_varint<B: BufMut>(data: &mut B, val: u64) {
if val < 2u64.pow(6) {
data.put_u8(val as u8);
} else if val < 2u64.pow(14) {
data.put_u16(0b01 << 14 | val as u16);
data.put_u16((0b01 << 14) | val as u16);
} else if val < 2u64.pow(30) {
data.put_u32(0b10 << 30 | val as u32);
data.put_u32((0b10 << 30) | val as u32);
} else if val < 2u64.pow(62) {
data.put_u64(0b11 << 62 | val);
data.put_u64((0b11 << 62) | val);
} else {
unreachable!("malformed varint");
}

View file

@ -206,7 +206,7 @@ pub struct TocEntry {
impl TocEntry {
pub fn frame_header(&self) -> u8 {
self.frame_type << 3 | (self.frame_quality_indicator as u8) << 2
(self.frame_type << 3) | ((self.frame_quality_indicator as u8) << 2)
}
}

View file

@ -374,10 +374,10 @@ impl RTPAv1Pay {
};
let aggr_header: [u8; 1] = [
(state.open_obu_fragment as u8) << 7 | // Z
((packet.last_obu_fragment_size.is_some()) as u8) << 6 | // Y
(w as u8) << 4 | // W
(packet.start_of_coded_video_sequence as u8) << 3 // N
((state.open_obu_fragment as u8) << 7) | // Z
(((packet.last_obu_fragment_size.is_some()) as u8) << 6) | // Y
((w as u8) << 4) | // W
((packet.start_of_coded_video_sequence as u8) << 3) // N
; 1];
writer

View file

@ -119,9 +119,9 @@ impl ObjectImpl for Paintable {
"background-color" => {
let color = self.background_color.get();
let v = (f32::clamp(color.red() * 255.0, 0.0, 255.0) as u32) << 24
| (f32::clamp(color.green() * 255.0, 0.0, 255.0) as u32) << 16
| (f32::clamp(color.blue() * 255.0, 0.0, 255.0) as u32) << 8
let v = ((f32::clamp(color.red() * 255.0, 0.0, 255.0) as u32) << 24)
| ((f32::clamp(color.green() * 255.0, 0.0, 255.0) as u32) << 16)
| ((f32::clamp(color.blue() * 255.0, 0.0, 255.0) as u32) << 8)
| (f32::clamp(color.alpha() * 255.0, 0.0, 255.0) as u32);
v.to_value()