From 3d154de8f3d4c7a2decea80239fd508efc96d99f Mon Sep 17 00:00:00 2001 From: Moritz Borcherding Date: Thu, 28 Nov 2024 21:22:31 +0100 Subject: [PATCH] make clippy happy --- src/bin/zstd.rs | 3 +-- src/encoding/match_generator.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bin/zstd.rs b/src/bin/zstd.rs index 01453d3..89f11c4 100644 --- a/src/bin/zstd.rs +++ b/src/bin/zstd.rs @@ -152,8 +152,7 @@ fn main() { } ); let mut dec = FrameDecoder::new(); - let mut decomp = Vec::new(); - decomp.reserve(input_len + 10000); + let mut decomp = Vec::with_capacity(input_len); dec.decode_all_to_vec(&output, &mut decomp).unwrap(); let mut original = Vec::new(); diff --git a/src/encoding/match_generator.rs b/src/encoding/match_generator.rs index cbe517f..ffb6d05 100644 --- a/src/encoding/match_generator.rs +++ b/src/encoding/match_generator.rs @@ -35,8 +35,7 @@ impl Matcher for MatchGeneratorDriver { self.current_space = space; self.current_space.as_mut().unwrap() } else { - let mut space = Vec::new(); - space.resize(self.slice_size, 0); + let mut space = alloc::vec![0; self.slice_size]; space.resize(space.capacity(), 0); self.current_space = Some(space); self.current_space.as_mut().unwrap() @@ -174,7 +173,7 @@ impl MatchGenerator { self.last_idx_in_sequence = last_entry.leaked_vec.data.len(); self.suffix_idx = last_entry.leaked_vec.data.len(); return Some(Sequence::Literals { - literals: &&last_entry.leaked_vec.data[last_idx_in_sequence..], + literals: &last_entry.leaked_vec.data[last_idx_in_sequence..], }); }