From 016340a0e75cf93fa138a9b37fb5260d04eb3ee0 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 7 Oct 2020 16:13:03 +0200 Subject: [PATCH] eliminate some cargo-clippy warnings --- nihav-game/src/codecs/mod.rs | 2 ++ nihav-game/src/codecs/vx.rs | 4 +--- nihav-game/src/demuxers/vx.rs | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nihav-game/src/codecs/mod.rs b/nihav-game/src/codecs/mod.rs index 4952b13..d54abb6 100644 --- a/nihav-game/src/codecs/mod.rs +++ b/nihav-game/src/codecs/mod.rs @@ -19,6 +19,8 @@ pub mod midivid3; #[cfg(feature="decoder_vmd")] pub mod vmd; #[cfg(feature="decoder_vx")] +#[allow(clippy::erasing_op)] +#[allow(clippy::identity_op)] pub mod vx; const GAME_CODECS: &[DecoderInfo] = &[ diff --git a/nihav-game/src/codecs/vx.rs b/nihav-game/src/codecs/vx.rs index 977e4e1..185c9f4 100644 --- a/nihav-game/src/codecs/vx.rs +++ b/nihav-game/src/codecs/vx.rs @@ -1119,8 +1119,7 @@ impl AudioState { } fn apply_lpc(dst: &mut [i32], src: &[i32], hist: &mut [i32], filt: &[i32; 8]) { - let mut hidx = 0; - for (out, src) in dst.iter_mut().zip(src.iter()) { + for (hidx, (out, src)) in dst.iter_mut().zip(src.iter()).enumerate() { let mut sum = *src << 14; for i in 0..8 { sum += hist[(hidx + i) & 7] * filt[i]; @@ -1128,7 +1127,6 @@ fn apply_lpc(dst: &mut [i32], src: &[i32], hist: &mut [i32], filt: &[i32; 8]) { let samp = sum >> 14; *out = samp; hist[hidx & 7] = samp; - hidx += 1; } } diff --git a/nihav-game/src/demuxers/vx.rs b/nihav-game/src/demuxers/vx.rs index 5d2786d..245ca49 100644 --- a/nihav-game/src/demuxers/vx.rs +++ b/nihav-game/src/demuxers/vx.rs @@ -19,6 +19,7 @@ struct VXDemuxer<'a> { impl<'a> DemuxCore<'a> for VXDemuxer<'a> { #[allow(unused_variables)] + #[allow(clippy::cast_lossless)] fn open(&mut self, strmgr: &mut StreamManager, _seek_index: &mut SeekIndex) -> DemuxerResult<()> { let src = &mut self.src; -- 2.39.5