Merge branch 'rust-1.78.0' into 'main'

Fix new Rust 1.78 clippy warnings

See merge request gstreamer/gst-plugins-rs!1559
This commit is contained in:
Sebastian Dröge 2024-05-02 15:50:26 +00:00
commit 5a272c25b0
12 changed files with 27 additions and 30 deletions

View file

@ -417,8 +417,8 @@ impl ObjectImpl for InputSelector {
let pads = self.pads.lock().unwrap();
let mut old_pad = None;
if let Some(ref pad) = pad {
if pads.sink_pads.get(pad).is_some() {
old_pad = state.active_sinkpad.clone();
if pads.sink_pads.contains_key(pad) {
old_pad.clone_from(&state.active_sinkpad);
state.active_sinkpad = Some(pad.clone());
state.switched_pad = true;
}

View file

@ -11,6 +11,7 @@
pub use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
use std::io;
#[allow(unused)]
pub trait ReadBytesExtShort: io::Read {
fn read_u16le(&mut self) -> io::Result<u16> {
self.read_u16::<LittleEndian>()
@ -76,6 +77,7 @@ pub trait ReadBytesExtShort: io::Read {
impl<T> ReadBytesExtShort for T where T: ReadBytesExt {}
#[allow(unused)]
pub trait WriteBytesExtShort: WriteBytesExt {
fn write_u16le(&mut self, n: u16) -> io::Result<()> {
self.write_u16::<LittleEndian>(n)

View file

@ -25,9 +25,10 @@ const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').ad
const PATH: &AsciiSet = &FRAGMENT.add(b'#').add(b'?').add(b'{').add(b'}');
const PATH_SEGMENT: &AsciiSet = &PATH.add(b'/').add(b'%');
impl ToString for GstS3Url {
fn to_string(&self) -> String {
format!(
impl std::fmt::Display for GstS3Url {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"s3://{}/{}/{}{}",
self.region,
self.bucket,

View file

@ -534,13 +534,14 @@ impl Transcriber {
fn prepare(&self) -> Result<(), gst::ErrorMessage> {
gst::debug!(CAT, imp: self, "Preparing");
let (access_key, secret_access_key, session_token);
{
let (access_key, secret_access_key, session_token) = {
let settings = self.settings.lock().unwrap();
access_key = settings.access_key.to_owned();
secret_access_key = settings.secret_access_key.to_owned();
session_token = settings.session_token.to_owned();
}
(
settings.access_key.clone(),
settings.secret_access_key.clone(),
settings.session_token.clone(),
)
};
gst::info!(CAT, imp: self, "Loading aws config...");
let _enter_guard = RUNTIME.enter();

View file

@ -59,7 +59,7 @@ impl Playlist {
while self.inner.segments.len() > max_playlist_length {
let to_remove = self.inner.segments.remove(0);
if self.inner.segments[0].map.is_none() {
self.inner.segments[0].map = to_remove.map.clone()
self.inner.segments[0].map.clone_from(&to_remove.map)
}
}
} else if self.inner.segments.len() > max_playlist_length {

View file

@ -100,6 +100,7 @@ pub trait RtpBaseDepay2Ext: IsA<RtpBaseDepay2> {
}
/// Finish currently pending buffers and push them downstream in a single buffer list.
#[allow(unused)]
fn finish_pending_buffers(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
self.upcast_ref::<RtpBaseDepay2>()
.imp()

View file

@ -101,6 +101,7 @@ pub trait RtpBasePay2Ext: IsA<RtpBasePay2> {
}
/// Returns a reference to the src pad.
#[allow(unused)]
fn src_pad(&self) -> &gst::Pad {
self.upcast_ref::<RtpBasePay2>().imp().src_pad()
}

View file

@ -44,14 +44,10 @@ impl Server {
I: for<'a> Deserialize<'a>,
O: Serialize + std::fmt::Debug + Send + Sync,
Factory: FnOnce(Pin<Box<dyn Stream<Item = (String, Option<I>)> + Send>>) -> St,
St: Stream<Item = (String, O)>,
St: Stream<Item = (String, O)> + Send + Unpin + 'static,
>(
factory: Factory,
) -> Self
where
O: Serialize + std::fmt::Debug,
St: Send + Unpin + 'static,
{
) -> Self {
let (tx, rx) = mpsc::channel::<(String, Option<String>)>(1000);
let mut handler = factory(Box::pin(rx.filter_map(|(peer_id, msg)| async move {
if let Some(msg) = msg {
@ -119,10 +115,10 @@ impl Server {
}
#[instrument(level = "debug", skip(self, stream))]
pub async fn accept_async<S: 'static>(&mut self, stream: S) -> Result<String, ServerError>
where
S: AsyncRead + AsyncWrite + Unpin + Send,
{
pub async fn accept_async<S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(
&mut self,
stream: S,
) -> Result<String, ServerError> {
let ws = match async_tungstenite::tokio::accept_async(stream).await {
Ok(ws) => ws,
Err(err) => {

View file

@ -606,7 +606,7 @@ impl Signaller {
return;
}
state.room_id = settings.room_id.clone();
state.room_id.clone_from(&settings.room_id);
(
state.transaction_id.clone().unwrap(),

View file

@ -3006,7 +3006,7 @@ impl BaseWebRTCSink {
if let Some(congestion_controller) = session.congestion_controller.as_mut() {
congestion_controller.loss_control(element, stats, &mut session.encoders);
}
session.stats = stats.to_owned();
stats.clone_into(&mut session.stats);
}
}

View file

@ -668,11 +668,6 @@ impl Default for WhipServer {
}
}
#[derive(Debug)]
struct InternalError;
impl warp::reject::Reject for InternalError {}
impl WhipServer {
pub fn on_webrtcbin_ready(&self) -> RustClosure {
glib::closure!(|signaller: &super::WhipServerSignaller,

View file

@ -1322,7 +1322,7 @@ impl Window {
height as u32,
gst_video::VideoOverlayFormatFlags::PREMULTIPLIED_ALPHA,
));
self.rectangle = ret.clone();
self.rectangle.clone_from(&ret);
ret
}
}