Fix various 1.80 clippy warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1688>
This commit is contained in:
Sebastian Dröge 2024-08-05 14:14:17 +03:00
parent 1316b821c4
commit fa060b9fa0
6 changed files with 33 additions and 12 deletions

View file

@ -44,7 +44,7 @@ pub struct OriginalBufferRestore {
} }
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
#[cfg(unused_code)] #[allow(dead_code)]
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new( gst::DebugCategory::new(
"originalbufferrestore", "originalbufferrestore",

View file

@ -19,7 +19,7 @@ pub struct OriginalBufferSave {
} }
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
#[cfg(unused_code)] #[allow(dead_code)]
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| { static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new( gst::DebugCategory::new(
"originalbuffersave", "originalbuffersave",

View file

@ -33,7 +33,10 @@ use std::net::UdpSocket;
use crate::runtime::Async; use crate::runtime::Async;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use std::os::{
fd::BorrowedFd,
unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd},
};
#[cfg(windows)] #[cfg(windows)]
use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket}; use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket};
@ -231,8 +234,14 @@ impl GioSocketWrapper {
} }
#[cfg(any( #[cfg(any(
bsd, target_os = "macos",
linux_like, target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "linux",
target_os = "android",
target_os = "aix", target_os = "aix",
target_os = "fuchsia", target_os = "fuchsia",
target_os = "haiku", target_os = "haiku",
@ -246,18 +255,30 @@ impl GioSocketWrapper {
let socket = self.as_socket(); let socket = self.as_socket();
sockopt::set_ip_tos(socket, tos)?; sockopt::set_ip_tos(
unsafe { BorrowedFd::borrow_raw(socket.as_raw_fd()) },
tos as u8,
)?;
if socket.family() == gio::SocketFamily::Ipv6 { if socket.family() == gio::SocketFamily::Ipv6 {
sockopt::set_ipv6_tclass(socket, tos)?; sockopt::set_ipv6_tclass(
unsafe { BorrowedFd::borrow_raw(socket.as_raw_fd()) },
tos as u32,
)?;
} }
Ok(()) Ok(())
} }
#[cfg(not(any( #[cfg(not(any(
bsd, target_os = "macos",
linux_like, target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "linux",
target_os = "android",
target_os = "aix", target_os = "aix",
target_os = "fuchsia", target_os = "fuchsia",
target_os = "haiku", target_os = "haiku",

View file

@ -503,7 +503,7 @@ fn test_extra_headers() {
|src| { |src| {
src.set_property( src.set_property(
"extra-headers", "extra-headers",
&gst::Structure::builder("headers") gst::Structure::builder("headers")
.field("foo", "bar") .field("foo", "bar")
.field("baz", 1i32) .field("baz", 1i32)
.field("list", gst::List::new([1i32, 2i32])) .field("list", gst::List::new([1i32, 2i32]))

View file

@ -1215,7 +1215,7 @@ impl RtpRecv {
// TODO what to do with the ssrc? // TODO what to do with the ssrc?
let event = gst_video::UpstreamForceKeyUnitEvent::builder() let event = gst_video::UpstreamForceKeyUnitEvent::builder()
.all_headers(fir) .all_headers(fir)
.other_field("ssrcs", &gst::Array::new(ssrcs)) .other_field("ssrcs", gst::Array::new(ssrcs))
.build(); .build();
let _ = rtp_send_sinkpad.push_event(event); let _ = rtp_send_sinkpad.push_event(event);

View file

@ -3513,7 +3513,7 @@ impl BaseWebRTCSink {
if let gst::EventView::Caps(caps) = event.view() { if let gst::EventView::Caps(caps) = event.view() {
sink.post_message(gst::message::Application::new( sink.post_message(gst::message::Application::new(
gst::Structure::builder("payloaded_caps") gst::Structure::builder("payloaded_caps")
.field("caps", &caps.caps().to_owned()) .field("caps", caps.caps_owned())
.build(), .build(),
)) ))
.expect("Could not send message"); .expect("Could not send message");