Fix new Rust 1.78 clippy warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1582>
This commit is contained in:
Sebastian Dröge 2024-05-02 18:22:50 +03:00
parent 143baf9562
commit 1bee96ccb4
8 changed files with 23 additions and 28 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

@ -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

@ -2916,7 +2916,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,