mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 04:51:26 +00:00
Fix clippy warnings after upgrade to Rust 1.77
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1512>
This commit is contained in:
parent
317f46ad97
commit
be12c0a5f7
15 changed files with 33 additions and 59 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);
|
||||
|
||||
|
|
|
@ -1040,10 +1040,7 @@ impl RtpBaseDepay2 {
|
|||
|
||||
// If npt-start is set, all the other values are also valid.
|
||||
if let Some(npt_start) = state.npt_start {
|
||||
let Some((mut npt_start_pts, npt_start_ext_rtptime)) = state.npt_start_times else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let (mut npt_start_pts, npt_start_ext_rtptime) = state.npt_start_times?;
|
||||
let clock_rate = state.clock_rate.unwrap();
|
||||
|
||||
let mut start = segment.start().unwrap();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -505,9 +505,7 @@ impl UriPlaylistBin {
|
|||
|
||||
let bin_weak = self.obj().downgrade();
|
||||
uridecodebin.connect("about-to-finish", false, move |_args| {
|
||||
let Some(bin) = bin_weak.upgrade() else {
|
||||
return None;
|
||||
};
|
||||
let bin = bin_weak.upgrade()?;
|
||||
let self_ = bin.imp();
|
||||
|
||||
gst::debug!(CAT, obj: bin, "current URI about to finish");
|
||||
|
|
|
@ -174,19 +174,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,
|
||||
|
|
|
@ -149,19 +149,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