From 12383b0c21569cacd324035e703561ee39cab566 Mon Sep 17 00:00:00 2001 From: phiresky Date: Fri, 7 Jun 2019 00:41:41 +0200 Subject: [PATCH] lol, i'm stupid --- src/adapters/tar.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/adapters/tar.rs b/src/adapters/tar.rs index 118dcee..8519d95 100644 --- a/src/adapters/tar.rs +++ b/src/adapters/tar.rs @@ -33,16 +33,6 @@ impl GetMetadata for TarAdapter { } } -// make a &mut Read into a owned Read because the streaming decompressors want to take ownership of their base Reads -struct WrapRead<'a> { - inner: &'a mut dyn Read, -} -impl<'a> Read for WrapRead<'a> { - fn read(&mut self, buf: &mut [u8]) -> std::io::Result { - self.inner.read(buf) - } -} - // feeling a little stupid here. why is this needed at all enum SpecRead { Gz(flate2::read::MultiGzDecoder), @@ -64,11 +54,10 @@ impl Read for SpecRead { } } // why do I need to wrap the output here in a specific type? is it possible with just a Box for every type? -fn decompress_any<'a, R>(filename: &Path, inp: &'a mut R) -> Fallible>> +fn decompress_any<'a, R>(filename: &Path, inp: &'a mut R) -> Fallible> where R: Read, { - let inp = WrapRead { inner: inp }; let extension = filename.extension().map(|e| e.to_string_lossy().to_owned()); match extension { Some(e) => Ok(match e.to_owned().as_ref() {