From 61d3e29467a4a634bbca56b8acfadcc346122a50 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 14 May 2019 13:46:56 +0200 Subject: [PATCH] realmedia: fix clippy errors --- nihav-realmedia/src/codecs/cook.rs | 1 + nihav-realmedia/src/codecs/mod.rs | 7 ++++++- nihav-realmedia/src/codecs/ralf.rs | 2 +- nihav-realmedia/src/codecs/rv34dsp.rs | 2 ++ nihav-realmedia/src/codecs/rv40dsp.rs | 2 ++ nihav-realmedia/src/codecs/rv60.rs | 6 +++--- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/nihav-realmedia/src/codecs/cook.rs b/nihav-realmedia/src/codecs/cook.rs index e5dba91..c7018c3 100644 --- a/nihav-realmedia/src/codecs/cook.rs +++ b/nihav-realmedia/src/codecs/cook.rs @@ -1118,6 +1118,7 @@ const COOK_CPL_BAND: [u8; MAX_SUBBANDS - 1] = [ 19, 19, 19 ]; +#[allow(clippy::approx_constant)] const COOK_DITHER_TAB: [f32; 9] = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.176777, 0.25, 0.707107, 1.0 ]; const COOK_QUANT_CENTROID: [[f32; 14]; 7] = [ diff --git a/nihav-realmedia/src/codecs/mod.rs b/nihav-realmedia/src/codecs/mod.rs index 1fe37e0..a5cc74c 100644 --- a/nihav-realmedia/src/codecs/mod.rs +++ b/nihav-realmedia/src/codecs/mod.rs @@ -7,8 +7,10 @@ macro_rules! validate { #[cfg(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))] mod rv3040; #[cfg(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))] +#[allow(clippy::erasing_op)] mod rv34codes; #[cfg(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))] +#[allow(clippy::erasing_op)] mod rv34dsp; #[cfg(feature="decoder_realvideo1")] @@ -18,16 +20,19 @@ pub mod rv20; #[cfg(feature="decoder_realvideo3")] pub mod rv30; #[cfg(feature="decoder_realvideo3")] +#[allow(clippy::erasing_op)] pub mod rv30dsp; #[cfg(feature="decoder_realvideo4")] pub mod rv40; #[cfg(feature="decoder_realvideo4")] +#[allow(clippy::erasing_op)] pub mod rv40dsp; #[cfg(feature="decoder_realvideo6")] pub mod rv60; #[cfg(feature="decoder_realvideo6")] pub mod rv60codes; #[cfg(feature="decoder_realvideo6")] +#[allow(clippy::erasing_op)] pub mod rv60dsp; #[cfg(feature="decoder_realaudio144")] @@ -62,7 +67,7 @@ const RM_CODECS: &[DecoderInfo] = &[ ]; pub fn realmedia_register_all_codecs(rd: &mut RegisteredDecoders) { - for decoder in RM_CODECS.into_iter() { + for decoder in RM_CODECS.iter() { rd.add_decoder(decoder.clone()); } } diff --git a/nihav-realmedia/src/codecs/ralf.rs b/nihav-realmedia/src/codecs/ralf.rs index 010c03a..6edfd85 100644 --- a/nihav-realmedia/src/codecs/ralf.rs +++ b/nihav-realmedia/src/codecs/ralf.rs @@ -140,7 +140,7 @@ impl Filter { } fn predict(&self, src: &[i32], bits: u8) -> i32 { let mut acc: i32 = 0; - for (f, s) in src.iter().rev().take(self.length).zip(self.coeffs.into_iter()) { + for (f, s) in src.iter().rev().take(self.length).zip(self.coeffs.iter()) { acc += *f * *s; } let bias = 1 << (self.bits - 1); diff --git a/nihav-realmedia/src/codecs/rv34dsp.rs b/nihav-realmedia/src/codecs/rv34dsp.rs index c8c87fb..21171c1 100644 --- a/nihav-realmedia/src/codecs/rv34dsp.rs +++ b/nihav-realmedia/src/codecs/rv34dsp.rs @@ -36,6 +36,7 @@ pub struct RV34CommonDSP { pub ipred16x16: [fn(buf: &mut [u8], idx: usize, stride: usize); 7], } +#[allow(clippy::erasing_op)] fn row_transform(src: &[i16], dst: &mut [i32]) { for i in 0..4 { let z0 = 13 * ((src[i + 4*0] as i32) + (src[i + 4*2] as i32)); @@ -61,6 +62,7 @@ fn mclip8(a: i32) -> u8 { else { a as u8 } } +#[allow(clippy::erasing_op)] impl RV34CommonDSP { pub fn new() -> Self { Self { diff --git a/nihav-realmedia/src/codecs/rv40dsp.rs b/nihav-realmedia/src/codecs/rv40dsp.rs index c2841df..66c3e96 100644 --- a/nihav-realmedia/src/codecs/rv40dsp.rs +++ b/nihav-realmedia/src/codecs/rv40dsp.rs @@ -299,6 +299,7 @@ fn rv40_weak_loop_filter4_h(pix: &mut [u8], off: usize, stride: usize, lim_p0q0: i16, lim_p1: i16, lim_q1: i16) { rv40_weak_loop_filter4(pix, off, stride, 1, filter_p1, filter_q1, alpha, beta, lim_p0q0, lim_p1, lim_q1); } +#[allow(clippy::eq_op)] fn rv40_weak_loop_filter4_v(pix: &mut [u8], off: usize, stride: usize, filter_p1: bool, filter_q1: bool, alpha: i16, beta: i16, lim_p0q0: i16, lim_p1: i16, lim_q1: i16) { @@ -457,6 +458,7 @@ fn rv40_loop_strength_h(pix: &[u8], off: usize, stride: usize, rv40_loop_strength(pix, off, stride, 1, beta, beta2, edge) } +#[allow(clippy::eq_op)] fn rv40_loop_strength_v(pix: &[u8], off: usize, stride: usize, beta: i16, beta2: i16, edge: bool) -> (bool, bool, bool) { let src = &pix[off - 3..][..stride * 3 + 3 + 3]; diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs index 4b7a2f2..1d13efd 100644 --- a/nihav-realmedia/src/codecs/rv60.rs +++ b/nihav-realmedia/src/codecs/rv60.rs @@ -21,7 +21,7 @@ impl UniqueList { fn add(&mut self, cand: A) { if self.fill == self.max_size { return; } let mut unique = true; - for el in self.list.into_iter().take(self.fill) { + for el in self.list.iter().take(self.fill) { if *el == cand { unique = false; break; @@ -1117,7 +1117,7 @@ println!(" left {} bits", br.left()); } } } - for el in RV60_CANDIDATE_INTRA_ANGLES.into_iter() { + for el in RV60_CANDIDATE_INTRA_ANGLES.iter() { ipm_cand.add(*el); } // actually decode prediction mode @@ -1129,7 +1129,7 @@ println!(" left {} bits", br.left()); let mut imode = mode; let mut ipm_cs: [u8; 3] = [ipm_cand.list[0], ipm_cand.list[1], ipm_cand.list[2]]; ipm_cs.sort(); - for ic in ipm_cs.into_iter() { + for ic in ipm_cs.iter() { if imode >= *ic { imode += 1; } -- 2.39.5