mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-28 22:41:02 +00:00
Fix clippy warnings after upgrade to Rust 1.77
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1531>
This commit is contained in:
parent
5f6ed181c2
commit
23403b5c9a
13 changed files with 31 additions and 52 deletions
|
@ -57,7 +57,7 @@ const READ: usize = 0;
|
|||
const WRITE: usize = 1;
|
||||
|
||||
thread_local! {
|
||||
static CURRENT_REACTOR: RefCell<Option<Reactor>> = RefCell::new(None);
|
||||
static CURRENT_REACTOR: RefCell<Option<Reactor>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -27,7 +27,7 @@ use super::{CallOnDrop, JoinHandle, Reactor};
|
|||
use crate::runtime::RUNTIME_CAT;
|
||||
|
||||
thread_local! {
|
||||
static CURRENT_SCHEDULER: RefCell<Option<HandleWeak>> = RefCell::new(None);
|
||||
static CURRENT_SCHEDULER: RefCell<Option<HandleWeak>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -24,7 +24,7 @@ use super::CallOnDrop;
|
|||
use crate::runtime::RUNTIME_CAT;
|
||||
|
||||
thread_local! {
|
||||
static CURRENT_TASK_ID: Cell<Option<TaskId>> = Cell::new(None);
|
||||
static CURRENT_TASK_ID: Cell<Option<TaskId>> = const { Cell::new(None) };
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug)]
|
||||
|
|
|
@ -642,10 +642,7 @@ impl ObjectImpl for S3HlsSink {
|
|||
self.hlssink.connect("get-playlist-stream", false, {
|
||||
let self_weak = self.downgrade();
|
||||
move |args| -> Option<glib::Value> {
|
||||
let Some(self_) = self_weak.upgrade() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let self_ = self_weak.upgrade()?;
|
||||
let s3client = self_.s3client_from_settings();
|
||||
let settings = self_.settings.lock().unwrap();
|
||||
let mut state = self_.state.lock().unwrap();
|
||||
|
@ -676,10 +673,7 @@ impl ObjectImpl for S3HlsSink {
|
|||
self.hlssink.connect("get-fragment-stream", false, {
|
||||
let self_weak = self.downgrade();
|
||||
move |args| -> Option<glib::Value> {
|
||||
let Some(self_) = self_weak.upgrade() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let self_ = self_weak.upgrade()?;
|
||||
let s3client = self_.s3client_from_settings();
|
||||
let settings = self_.settings.lock().unwrap();
|
||||
let mut state = self_.state.lock().unwrap();
|
||||
|
@ -710,10 +704,7 @@ impl ObjectImpl for S3HlsSink {
|
|||
self.hlssink.connect("delete-fragment", false, {
|
||||
let self_weak = self.downgrade();
|
||||
move |args| -> Option<glib::Value> {
|
||||
let Some(self_) = self_weak.upgrade() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let self_ = self_weak.upgrade()?;
|
||||
let s3_client = self_.s3client_from_settings();
|
||||
let settings = self_.settings.lock().unwrap();
|
||||
|
||||
|
|
|
@ -1045,7 +1045,7 @@ impl BaseSrcImpl for ReqwestHttpSrc {
|
|||
.ok_or_else(|| {
|
||||
gst::error_msg!(gst::CoreError::StateChange, ["Can't start without an URI"])
|
||||
})
|
||||
.map(|uri| uri.clone())?;
|
||||
.cloned()?;
|
||||
|
||||
gst::debug!(CAT, imp: self, "Starting for URI {}", uri);
|
||||
|
||||
|
|
|
@ -1140,9 +1140,7 @@ impl RtspManager {
|
|||
if !rtpbin2 {
|
||||
let on_bye = |args: &[glib::Value]| {
|
||||
let m = args[0].get::<gst::Element>().unwrap();
|
||||
let Some(obj) = m.parent() else {
|
||||
return None;
|
||||
};
|
||||
let obj = m.parent()?;
|
||||
let bin = obj.downcast::<gst::Bin>().unwrap();
|
||||
bin.send_event(gst::event::Eos::new());
|
||||
None
|
||||
|
|
|
@ -483,6 +483,7 @@ struct PipelineWrapper(gst::Pipeline);
|
|||
|
||||
// Structure to generate GstNavigation event from a WebRTCDataChannel
|
||||
// This is simply used to hold references to the inner items.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
struct NavigationEventHandler((glib::SignalHandlerId, WebRTCDataChannel));
|
||||
|
||||
|
|
|
@ -548,10 +548,7 @@ impl WhepSrc {
|
|||
let self_weak = self.downgrade();
|
||||
self.webrtcbin.connect("on-negotiation-needed", false, {
|
||||
move |_| {
|
||||
let Some(self_) = self_weak.upgrade() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let self_ = self_weak.upgrade()?;
|
||||
let settings = self_.settings.lock().unwrap();
|
||||
|
||||
let endpoint =
|
||||
|
|
|
@ -534,7 +534,7 @@ impl ObjectImpl for FallbackSrc {
|
|||
|
||||
// Called whenever a value of a property is read. It can be called
|
||||
// at any time from any thread.
|
||||
#[allow(clippy::block_in_conditions)]
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
match pspec.name() {
|
||||
"enable-audio" => {
|
||||
|
@ -3237,7 +3237,7 @@ impl FallbackSrc {
|
|||
});
|
||||
}
|
||||
|
||||
#[allow(clippy::block_in_conditions)]
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
fn schedule_source_restart_timeout(
|
||||
&self,
|
||||
state: &mut State,
|
||||
|
@ -3400,7 +3400,7 @@ impl FallbackSrc {
|
|||
source.restart_timeout = Some(timeout);
|
||||
}
|
||||
|
||||
#[allow(clippy::block_in_conditions)]
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
fn have_fallback_activated(&self, state: &State) -> bool {
|
||||
let mut have_audio = false;
|
||||
let mut have_video = false;
|
||||
|
|
|
@ -771,7 +771,7 @@ impl FallbackSwitch {
|
|||
is_active
|
||||
);
|
||||
|
||||
#[allow(clippy::block_in_conditions)]
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
let output_clockid = if is_active {
|
||||
pad_state.schedule_clock(
|
||||
self,
|
||||
|
|
|
@ -693,7 +693,7 @@ impl ToggleRecord {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::block_in_conditions)]
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
fn handle_secondary_stream<T: HandleData>(
|
||||
&self,
|
||||
pad: &gst::Pad,
|
||||
|
|
|
@ -171,19 +171,15 @@ impl State {
|
|||
match parse_timecode(framerate, drop_frame, tc) {
|
||||
Ok(timecode) => Ok(timecode),
|
||||
Err(timecode) => {
|
||||
let last_timecode =
|
||||
self.last_timecode
|
||||
.as_ref()
|
||||
.map(Clone::clone)
|
||||
.ok_or_else(|| {
|
||||
gst::element_imp_error!(
|
||||
imp,
|
||||
gst::StreamError::Decode,
|
||||
["Invalid first timecode {:?}", timecode]
|
||||
);
|
||||
let last_timecode = self.last_timecode.clone().ok_or_else(|| {
|
||||
gst::element_imp_error!(
|
||||
imp,
|
||||
gst::StreamError::Decode,
|
||||
["Invalid first timecode {:?}", timecode]
|
||||
);
|
||||
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
gst::warning!(
|
||||
CAT,
|
||||
|
|
|
@ -146,19 +146,15 @@ impl State {
|
|||
match parse_timecode(framerate, tc) {
|
||||
Ok(timecode) => Ok(timecode),
|
||||
Err(err) => {
|
||||
let last_timecode =
|
||||
self.last_timecode
|
||||
.as_ref()
|
||||
.map(Clone::clone)
|
||||
.ok_or_else(|| {
|
||||
gst::element_imp_error!(
|
||||
imp,
|
||||
gst::StreamError::Decode,
|
||||
["Invalid first timecode {:?}", err]
|
||||
);
|
||||
let last_timecode = self.last_timecode.clone().ok_or_else(|| {
|
||||
gst::element_imp_error!(
|
||||
imp,
|
||||
gst::StreamError::Decode,
|
||||
["Invalid first timecode {:?}", err]
|
||||
);
|
||||
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
gst::warning!(
|
||||
CAT,
|
||||
|
|
Loading…
Reference in a new issue