From: Kostya Shishkov Date: Wed, 24 May 2023 17:20:11 +0000 (+0200) Subject: core/compr: fix clippy warnings X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=820e8a4a4aea56dc0a4bc0bc9e3f38637910a936;hp=497aa09d91eadb4b8bc8126cdab695946d5ef9db;p=nihav.git core/compr: fix clippy warnings --- diff --git a/nihav-core/src/compr/deflate.rs b/nihav-core/src/compr/deflate.rs index 3932473..e3f1f13 100644 --- a/nihav-core/src/compr/deflate.rs +++ b/nihav-core/src/compr/deflate.rs @@ -790,6 +790,7 @@ impl Inflate { self.state = InflateState::Start; } + #[allow(clippy::comparison_chain)] ///! Decompresses input data into output returning the uncompressed data length. pub fn uncompress(src: &[u8], dst: &mut [u8]) -> DecompressResult { let mut csrc = CurrentSource::new(src, BitReaderState::default()); @@ -886,13 +887,11 @@ impl Inflate { } let hdist = csrc.read(5)? as usize + 1; let hclen = csrc.read(4)? as usize + 4; - let mut cur_len_idx = 0; let mut len_lengths = [0; 19]; let mut all_lengths = [0; NUM_LITERALS + NUM_DISTS]; - for _ in 0..hclen { + for cur_len_idx in 0..hclen { len_lengths[LEN_RECODE[cur_len_idx]] = csrc.read(3)? as u8; - cur_len_idx += 1; } let mut len_codes = [ShortCodebookDesc { code: 0, bits: 0 }; 19]; lengths_to_codes(&len_lengths, &mut len_codes)?;