Skip to content

Commit

Permalink
remove a few more dyns
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Jul 16, 2024
1 parent f0faf24 commit bf63d19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,8 @@ impl<R: Read + Seek> ZipArchive<R> {
self.reader.rewind()?;
/* Find the end of the file data. */
let length_to_read = self.shared.dir_start;
/* Produce a Read that reads bytes up until the start of the central directory header.
* This "as &mut dyn Read" trick is used elsewhere to avoid having to clone the underlying
* handle, which it really shouldn't need to anyway. */
let mut limited_raw = (&mut self.reader as &mut dyn Read).take(length_to_read);
/* Produce a Read that reads bytes up until the start of the central directory header. */
let mut limited_raw = self.reader.by_ref().take(length_to_read);
/* Copy over file data from source archive directly. */
io::copy(&mut limited_raw, &mut w)?;

Expand Down
4 changes: 2 additions & 2 deletions src/unstable/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ pub mod streaming {
} = self;
if *remaining_before_next_entry > 0 {
io::copy(
&mut (reader as &mut dyn Read).take(*remaining_before_next_entry),
&mut reader.by_ref().take(*remaining_before_next_entry),
&mut io::sink(),
)?;
*remaining_before_next_entry = 0;
Expand Down Expand Up @@ -577,7 +577,7 @@ pub mod streaming {
} = self;
if *remaining_before_next_entry > 0 {
io::copy(
&mut (reader as &mut dyn Read).take(*remaining_before_next_entry),
&mut reader.by_ref().take(*remaining_before_next_entry),
&mut io::sink(),
)?;
*remaining_before_next_entry = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<W: Write> Write for MaybeEncrypted<W> {
}
}

enum GenericZipWriter<W: Write + Seek> {
enum GenericZipWriter<W: Write> {
Closed,
Storer(MaybeEncrypted<W>),
#[cfg(feature = "deflate-flate2")]
Expand Down

0 comments on commit bf63d19

Please sign in to comment.