diff --git a/Cargo.toml b/Cargo.toml index fe992390..e9a318dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [package] +edition = "2021" name = "bzip2" version = "0.4.4" authors = ["Alex Crichton "] diff --git a/src/bufread.rs b/src/bufread.rs index 14d8a4e7..d5635e90 100644 --- a/src/bufread.rs +++ b/src/bufread.rs @@ -3,7 +3,7 @@ use std::io; use std::io::prelude::*; -use {Action, Compress, Compression, Decompress, Status}; +use crate::{Action, Compress, Compression, Decompress, Status}; /// A bz2 encoder, or compressor. /// diff --git a/src/mem.rs b/src/mem.rs index ff7d9a5a..1d1c69fe 100644 --- a/src/mem.rs +++ b/src/mem.rs @@ -8,7 +8,7 @@ use std::slice; use libc::{c_int, c_uint}; -use {ffi, Compression}; +use crate::{ffi, Compression}; /// Representation of an in-memory compression stream. /// diff --git a/src/read.rs b/src/read.rs index 475ef2a3..d0af4a1f 100644 --- a/src/read.rs +++ b/src/read.rs @@ -3,8 +3,8 @@ use std::io::prelude::*; use std::io::{self, BufReader}; -use bufread; -use Compression; +use crate::bufread; +use crate::Compression; /// A compression stream which wraps an uncompressed stream of data. Compressed /// data will be read from the stream. @@ -188,13 +188,13 @@ impl Read for MultiBzDecoder { #[cfg(test)] mod tests { + use crate::read::{BzDecoder, BzEncoder, MultiBzDecoder}; + use crate::Compression; use partial_io::quickcheck_types::{GenInterrupted, PartialWithErrors}; use partial_io::PartialRead; use rand::distributions::Standard; use rand::{thread_rng, Rng}; - use read::{BzDecoder, BzEncoder, MultiBzDecoder}; - use std::io::prelude::*; - use Compression; + use std::io::Read; #[test] fn smoke() { diff --git a/src/write.rs b/src/write.rs index 21bf982b..2854d3ef 100644 --- a/src/write.rs +++ b/src/write.rs @@ -3,7 +3,7 @@ use std::io; use std::io::prelude::*; -use {Action, Compress, Compression, Decompress, Status}; +use crate::{Action, Compress, Compression, Decompress, Status}; /// A compression stream which will have uncompressed data written to it and /// will write compressed data to an output stream. @@ -268,6 +268,7 @@ impl Drop for BzDecoder { #[cfg(test)] mod tests { use super::{BzDecoder, BzEncoder}; + use crate::Compression; use partial_io::quickcheck_types::{GenInterrupted, PartialWithErrors}; use partial_io::PartialWrite; use std::io::prelude::*; @@ -276,7 +277,7 @@ mod tests { #[test] fn smoke() { let d = BzDecoder::new(Vec::new()); - let mut c = BzEncoder::new(d, ::Compression::default()); + let mut c = BzEncoder::new(d, Compression::default()); c.write_all(b"12834").unwrap(); let s = repeat("12345").take(100000).collect::(); c.write_all(s.as_bytes()).unwrap(); @@ -289,7 +290,7 @@ mod tests { #[test] fn write_empty() { let d = BzDecoder::new(Vec::new()); - let mut c = BzEncoder::new(d, ::Compression::default()); + let mut c = BzEncoder::new(d, Compression::default()); c.write(b"").unwrap(); let data = c.finish().unwrap().finish().unwrap(); assert_eq!(&data[..], b""); @@ -301,7 +302,7 @@ mod tests { fn test(v: Vec) -> bool { let w = BzDecoder::new(Vec::new()); - let mut w = BzEncoder::new(w, ::Compression::default()); + let mut w = BzEncoder::new(w, Compression::default()); w.write_all(&v).unwrap(); v == w.finish().unwrap().finish().unwrap() } @@ -317,7 +318,7 @@ mod tests { decode_ops: PartialWithErrors, ) -> bool { let w = BzDecoder::new(PartialWrite::new(Vec::new(), decode_ops)); - let mut w = BzEncoder::new(PartialWrite::new(w, encode_ops), ::Compression::default()); + let mut w = BzEncoder::new(PartialWrite::new(w, encode_ops), Compression::default()); w.write_all(&v).unwrap(); v == w .finish()