Fix/silence various new clippy warnings

This commit is contained in:
Sebastian Dröge 2020-03-19 12:55:29 +02:00
parent cd2957679d
commit 5dd80e0706
6 changed files with 10 additions and 8 deletions

View file

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

View file

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

View file

@ -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);
}

View file

@ -484,7 +484,7 @@ impl ElementImpl for FallbackSwitch {
let agg = element.downcast_ref::<gst_base::Aggregator>().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;

View file

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

View file

@ -133,7 +133,7 @@ pub fn block_on<Fut: Future>(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<Fut: Future>(future: Fut) -> Fut::Output {
res
})
.await;
res
.await
});
*cur_ctx.borrow_mut() = None;