eliminate some cargo-clippy warnings
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 7 Oct 2020 14:13:03 +0000 (16:13 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 7 Oct 2020 14:13:03 +0000 (16:13 +0200)
nihav-game/src/codecs/mod.rs
nihav-game/src/codecs/vx.rs
nihav-game/src/demuxers/vx.rs

index 4952b13e0cd3d506100ae47a139d0508af41d757..d54abb6e3f6aa7271ef424d76d3689121f5828c9 100644 (file)
@@ -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] = &[
index 977e4e188c83dc39b8aef0eb823f4d7ef5124c36..185c9f4d434e915f8507dd3c4b095dc9a342f0f3 100644 (file)
@@ -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;
     }
 }
 
index 5d2786db2804b247c7e358dc06893b605a46a962..245ca49ef62547c97c69814fd902844e734f7701 100644 (file)
@@ -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;