You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2025/04/07 08:50:35 UTC
(avro-rs) 02/04: Issue #169 - Do not allow unused imports. Import only what is needed when it is needed
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch miniz_oxide_improvements
in repository https://gitbox.apache.org/repos/asf/avro-rs.git
commit 8250126b95492dd7ac303d24117818a1001a4ec6
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Mon Apr 7 11:25:00 2025 +0300
Issue #169 - Do not allow unused imports. Import only what is needed when it is needed
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
avro/src/codec.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/avro/src/codec.rs b/avro/src/codec.rs
index 599b59d..28f3a5e 100644
--- a/avro/src/codec.rs
+++ b/avro/src/codec.rs
@@ -17,8 +17,6 @@
//! Logic for all supported compression codecs in Avro.
use crate::{types::Value, AvroResult, Error};
-#[allow(unused_imports)] // may be flagged as unused when only DEFLATE is enabled
-use std::io::{Read, Write};
use strum_macros::{EnumIter, EnumString, IntoStaticStr};
/// The compression codec used to compress blocks.
@@ -83,6 +81,7 @@ impl Codec {
}
#[cfg(feature = "zstandard")]
Codec::Zstandard(settings) => {
+ use std::io::Write;
let mut encoder =
zstd::Encoder::new(Vec::new(), settings.compression_level as i32).unwrap();
encoder.write_all(stream).map_err(Error::ZstdCompress)?;
@@ -91,6 +90,7 @@ impl Codec {
#[cfg(feature = "bzip")]
Codec::Bzip2(settings) => {
use bzip2::read::BzEncoder;
+ use std::io::Read;
let mut encoder = BzEncoder::new(&stream[..], settings.compression());
let mut buffer = Vec::new();
@@ -100,6 +100,7 @@ impl Codec {
#[cfg(feature = "xz")]
Codec::Xz(settings) => {
use xz2::read::XzEncoder;
+ use std::io::Read;
let mut encoder = XzEncoder::new(&stream[..], settings.compression_level as u32);
let mut buffer = Vec::new();
@@ -168,6 +169,7 @@ impl Codec {
#[cfg(feature = "bzip")]
Codec::Bzip2(_) => {
use bzip2::read::BzDecoder;
+ use std::io::Read;
let mut decoder = BzDecoder::new(&stream[..]);
let mut decoded = Vec::new();
@@ -177,6 +179,7 @@ impl Codec {
#[cfg(feature = "xz")]
Codec::Xz(_) => {
use xz2::read::XzDecoder;
+ use std::io::Read;
let mut decoder = XzDecoder::new(&stream[..]);
let mut decoded: Vec<u8> = Vec::new();