diff --git a/src/block/compress.rs b/src/block/compress.rs index c18474a..d283d49 100644 --- a/src/block/compress.rs +++ b/src/block/compress.rs @@ -16,10 +16,9 @@ use crate::sink::Sink; use crate::sink::SliceSink; #[allow(unused_imports)] use alloc::vec; -use alloc::vec::Vec; -#[cfg(feature = "safe-encode")] -use core::convert::TryInto; +#[allow(unused_imports)] +use alloc::vec::Vec; use super::hashtable::HashTable4K; use super::hashtable::HashTable4KU16; diff --git a/src/block/decompress_safe.rs b/src/block/decompress_safe.rs index cebe3cb..fa7c0b3 100644 --- a/src/block/decompress_safe.rs +++ b/src/block/decompress_safe.rs @@ -1,12 +1,13 @@ //! The block decompression algorithm. -use core::convert::TryInto; - use crate::block::DecompressError; use crate::block::MINMATCH; use crate::sink::Sink; use crate::sink::SliceSink; + +#[allow(unused_imports)] use alloc::vec; +#[allow(unused_imports)] use alloc::vec::Vec; /// Read an integer. diff --git a/src/block/hashtable.rs b/src/block/hashtable.rs index 7c29db7..7ba59f7 100644 --- a/src/block/hashtable.rs +++ b/src/block/hashtable.rs @@ -1,5 +1,4 @@ use alloc::boxed::Box; -use core::convert::TryInto; /// The Hashtable trait used by the compression to store hashed bytes to their position. /// `val` can be maximum the size of the input in bytes. @@ -36,6 +35,7 @@ fn hash5(sequence: usize) -> u32 { pub trait HashTable { fn get_at(&self, pos: usize) -> usize; fn put_at(&mut self, pos: usize, val: usize); + #[allow(dead_code)] fn clear(&mut self); #[inline] #[cfg(target_pointer_width = "64")] diff --git a/src/block/mod.rs b/src/block/mod.rs index 31c52f4..58ab249 100644 --- a/src/block/mod.rs +++ b/src/block/mod.rs @@ -30,7 +30,6 @@ pub(crate) mod decompress; pub use compress::*; pub use decompress::*; -use core::convert::TryInto; use core::fmt; pub(crate) const WINDOW_SIZE: usize = 64 * 1024; diff --git a/src/frame/decompress.rs b/src/frame/decompress.rs index 2b495e2..3a64831 100644 --- a/src/frame/decompress.rs +++ b/src/frame/decompress.rs @@ -1,5 +1,4 @@ use std::{ - convert::TryInto, fmt, hash::Hasher, io::{self, BufRead, ErrorKind}, @@ -371,7 +370,7 @@ impl io::Read for FrameDecoder { let mut written = 0; loop { match self.fill_buf() { - Ok(b) if b.is_empty() => return Ok(written), + Ok([]) => return Ok(written), Ok(b) => { let s = std::str::from_utf8(b).map_err(|_| { io::Error::new( @@ -394,7 +393,7 @@ impl io::Read for FrameDecoder { let mut written = 0; loop { match self.fill_buf() { - Ok(b) if b.is_empty() => return Ok(written), + Ok([]) => return Ok(written), Ok(b) => { buf.extend_from_slice(b); let len = b.len(); diff --git a/src/frame/header.rs b/src/frame/header.rs index 1513c11..04e0e6a 100644 --- a/src/frame/header.rs +++ b/src/frame/header.rs @@ -2,7 +2,6 @@ use twox_hash::XxHash32; use super::Error; use std::{ - convert::TryInto, fmt::Debug, hash::Hasher, io, diff --git a/src/sink.rs b/src/sink.rs index a440a2d..767afd9 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -16,10 +16,10 @@ pub fn vec_sink_for_compression( pos: usize, required_capacity: usize, ) -> SliceSink { - return { + { vec.resize(offset + required_capacity, 0); SliceSink::new(&mut vec[offset..], pos) - }; + } } /// Returns a Sink implementation appropriate for outputing up to `required_capacity` @@ -35,10 +35,10 @@ pub fn vec_sink_for_decompression( pos: usize, required_capacity: usize, ) -> SliceSink { - return { + { vec.resize(offset + required_capacity, 0); SliceSink::new(&mut vec[offset..], pos) - }; + } } pub trait Sink { @@ -47,6 +47,7 @@ pub trait Sink { unsafe fn pos_mut_ptr(&mut self) -> *mut u8; /// read byte at position + #[allow(dead_code)] fn byte_at(&mut self, pos: usize) -> u8; /// Pushes a byte to the end of the Sink.