From a672add4e7328d4e17c3deaa33d0dab8221b0944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Sat, 23 Jun 2018 14:49:16 +0200 Subject: [PATCH] Remove unnecessary clone() calls --- src/dir.rs | 3 +-- src/file.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dir.rs b/src/dir.rs index 0808585..f167ad8 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -109,10 +109,9 @@ impl <'a, T: ReadWriteSeek + 'a> Dir<'a, T> { /// Creates directory entries iterator. pub fn iter(&self) -> DirIter<'a, T> { - self.stream.clone(); DirIter { stream: self.stream.clone(), - fs: self.fs.clone(), + fs: self.fs, err: false, } } diff --git a/src/file.rs b/src/file.rs index 7974ff7..e6cff7f 100644 --- a/src/file.rs +++ b/src/file.rs @@ -240,7 +240,7 @@ impl<'a, T: ReadWriteSeek> Write for File<'a, T> { if self.first_cluster.is_none() { self.set_first_cluster(new_cluster); } - if self.entry.clone().map_or(true, |e| e.inner().size().is_none()) { + if self.entry.iter().next().map_or(true, |e| e.inner().size().is_none()) { // zero new directory cluster trace!("zeroing directory cluser {}", new_cluster); let abs_pos = self.fs.offset_from_cluster(new_cluster);