From deef891c305e11a350fb23adab2e7443a337f9a0 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Tue, 12 May 2020 23:51:53 -0700 Subject: [PATCH] swf: Don't error if both libflate and flate2 features are enabled Fixes errors I was getting from rust-analyzer checking with all features enabled. --- swf/src/read.rs | 2 +- swf/src/write.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/swf/src/read.rs b/swf/src/read.rs index ea3fdc3a4..3d58a73fe 100644 --- a/swf/src/read.rs +++ b/swf/src/read.rs @@ -133,7 +133,7 @@ fn make_zlib_reader<'a, R: Read + 'a>(input: R) -> Result> { Ok(Box::new(ZlibDecoder::new(input))) } -#[cfg(feature = "libflate")] +#[cfg(all(feature = "libflate", not(feature = "flate2")))] fn make_zlib_reader<'a, R: Read + 'a>(input: R) -> Result> { use libflate::zlib::Decoder; let decoder = Decoder::new(input)?; diff --git a/swf/src/write.rs b/swf/src/write.rs index 875edc7e3..bd81bfd90 100644 --- a/swf/src/write.rs +++ b/swf/src/write.rs @@ -88,7 +88,7 @@ fn write_zlib_swf(mut output: W, swf_body: &[u8]) -> Result<()> { Ok(()) } -#[cfg(feature = "libflate")] +#[cfg(all(feature = "libflate", not(feature = "flate2")))] fn write_zlib_swf(mut output: W, swf_body: &[u8]) -> Result<()> { use libflate::zlib::Encoder; let mut encoder = Encoder::new(&mut output)?;