From 5dd80e0706f4956637f39acce229d399b25456f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 19 Mar 2020 12:55:29 +0200 Subject: [PATCH] Fix/silence various new clippy warnings --- gst-plugin-closedcaption/src/cea608tott.rs | 2 +- gst-plugin-closedcaption/src/lib.rs | 2 ++ gst-plugin-closedcaption/tests/cea608tott.rs | 4 ++-- gst-plugin-fallbackswitch/src/fallbackswitch.rs | 2 +- gst-plugin-rav1e/src/rav1enc.rs | 2 ++ gst-plugin-threadshare/src/runtime/executor.rs | 6 ++---- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gst-plugin-closedcaption/src/cea608tott.rs b/gst-plugin-closedcaption/src/cea608tott.rs index 45df0666..b1f83624 100644 --- a/gst-plugin-closedcaption/src/cea608tott.rs +++ b/gst-plugin-closedcaption/src/cea608tott.rs @@ -189,7 +189,7 @@ impl Cea608ToTt { m %= 60; let ns = time % 1_000_000_000; - (h as u64, m as u8, s as u8, (ns / 1000_000) as u16) + (h as u64, m as u8, s as u8, (ns / 1_000_000) as u16) } fn create_vtt_buffer( diff --git a/gst-plugin-closedcaption/src/lib.rs b/gst-plugin-closedcaption/src/lib.rs index a5e10891..88a99a48 100644 --- a/gst-plugin-closedcaption/src/lib.rs +++ b/gst-plugin-closedcaption/src/lib.rs @@ -36,6 +36,8 @@ extern crate pretty_assertions; mod cea608tott; #[allow(non_camel_case_types, non_upper_case_globals)] +#[allow(clippy::redundant_static_lifetimes, clippy::unreadable_literal)] +#[allow(clippy::useless_transmute, clippy::trivially_copy_pass_by_ref)] pub mod cea608tott_ffi; mod line_reader; mod mcc_enc; diff --git a/gst-plugin-closedcaption/tests/cea608tott.rs b/gst-plugin-closedcaption/tests/cea608tott.rs index bfce8ff0..34a46b88 100644 --- a/gst-plugin-closedcaption/tests/cea608tott.rs +++ b/gst-plugin-closedcaption/tests/cea608tott.rs @@ -80,8 +80,8 @@ fn test_parse() { ); let data = buf.map_readable().unwrap(); - let s = - std::str::from_utf8(&*data).expect(&format!("Non-UTF8 data for {}th buffer", i + 1)); + let s = std::str::from_utf8(&*data) + .unwrap_or_else(|_| panic!("Non-UTF8 data for {}th buffer", i + 1)); assert_eq!(e.2, s, "Unexpected data for {}th buffer", i + 1); } diff --git a/gst-plugin-fallbackswitch/src/fallbackswitch.rs b/gst-plugin-fallbackswitch/src/fallbackswitch.rs index 8d05884d..ddf4cca4 100644 --- a/gst-plugin-fallbackswitch/src/fallbackswitch.rs +++ b/gst-plugin-fallbackswitch/src/fallbackswitch.rs @@ -484,7 +484,7 @@ impl ElementImpl for FallbackSwitch { let agg = element.downcast_ref::().unwrap(); let fallback_sink_templ = agg.get_pad_template("fallback_sink").unwrap(); if templ != &fallback_sink_templ - || (name.is_some() && name.as_ref().map(String::as_str) != Some("fallback_sink")) + || (name.is_some() && name.as_deref() != Some("fallback_sink")) { gst_error!(CAT, obj: agg, "Wrong pad template or name"); return None; diff --git a/gst-plugin-rav1e/src/rav1enc.rs b/gst-plugin-rav1e/src/rav1enc.rs index af064fe2..0d69a19c 100644 --- a/gst-plugin-rav1e/src/rav1enc.rs +++ b/gst-plugin-rav1e/src/rav1enc.rs @@ -484,6 +484,8 @@ impl VideoEncoderImpl for Rav1Enc { Ok(()) } + // For the colorimetry mapping below + #[allow(clippy::wildcard_in_or_patterns)] fn set_format( &self, element: &gst_video::VideoEncoder, diff --git a/gst-plugin-threadshare/src/runtime/executor.rs b/gst-plugin-threadshare/src/runtime/executor.rs index ed2e16a8..2310485e 100644 --- a/gst-plugin-threadshare/src/runtime/executor.rs +++ b/gst-plugin-threadshare/src/runtime/executor.rs @@ -133,7 +133,7 @@ pub fn block_on(future: Fut) -> Fut::Output { *cur_ctx.borrow_mut() = Some(context.downgrade()); let res = futures::executor::block_on(async move { - let res = CURRENT_TASK_ID + CURRENT_TASK_ID .scope(TaskId(0), async move { let task_id = CURRENT_TASK_ID.try_with(|task_id| *task_id).ok(); assert_eq!(task_id, Some(TaskId(0))); @@ -148,9 +148,7 @@ pub fn block_on(future: Fut) -> Fut::Output { res }) - .await; - - res + .await }); *cur_ctx.borrow_mut() = None;