From 63793a32ffc45a752756be4a9dbcbeb2f08e2348 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Thu, 2 May 2024 18:04:05 -0700 Subject: [PATCH] chore: Fix errors by moving `use` statements inside the cfg-guarded function that uses them --- examples/write-large-file.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/write-large-file.rs b/examples/write-large-file.rs index 47810dad..f9005cf0 100644 --- a/examples/write-large-file.rs +++ b/examples/write-large-file.rs @@ -1,8 +1,5 @@ //! Write a huge file with lots of zeros, that should compress perfectly. -use std::io::Write; - -use zip::write::SimpleFileOptions; fn main() -> Result<(), Box> { if !cfg!(feature = "_deflate-any") { return Err("Please enable one of the deflate features".into()); @@ -22,6 +19,10 @@ fn main() -> Result<(), Box> { #[cfg(feature = "_deflate-any")] fn doit(filename: &str) -> zip::result::ZipResult<()> { + use std::io::Write; + + use zip::write::SimpleFileOptions; + let file = std::fs::File::create(filename)?; let mut zip = zip::ZipWriter::new(file);