From 57c8444d8eaa520b5eee27c6b79508015dab77bd Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Sat, 6 Apr 2019 17:58:12 +0200 Subject: [PATCH] Simplify test code of compression --- src/compression.rs | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/compression.rs b/src/compression.rs index cbf73b79..9585ef3b 100644 --- a/src/compression.rs +++ b/src/compression.rs @@ -65,25 +65,14 @@ mod test { } } - #[cfg(all(not(feature = "bzip2"), feature = "deflate"))] fn methods() -> Vec { - vec![CompressionMethod::Stored, CompressionMethod::Deflated] + let mut methods = Vec::new(); + methods.push(CompressionMethod::Stored); + #[cfg(feature="deflate")] methods.push(CompressionMethod::Deflated); + #[cfg(feature="bzip2")] methods.push(CompressionMethod::Bzip2); + methods } - #[cfg(all(not(feature = "deflate"), feature = "bzip2"))] - fn methods() -> Vec { - vec![CompressionMethod::Stored, CompressionMethod::Bzip2] - } - - #[cfg(all(feature = "bzip2", feature = "deflate"))] - fn methods() -> Vec { - vec![CompressionMethod::Stored, CompressionMethod::Deflated, CompressionMethod::Bzip2] - } - - #[cfg(all(not(feature = "bzip2"), not(feature = "deflate")))] - fn methods() -> Vec { - vec![CompressionMethod::Stored] - } #[test] fn to_eq_from() {