Remove unnecessary clone() calls

This commit is contained in:
Rafał Harabień 2018-06-23 14:49:16 +02:00
parent 099434c45d
commit a672add4e7
2 changed files with 2 additions and 3 deletions

View File

@ -109,10 +109,9 @@ impl <'a, T: ReadWriteSeek + 'a> Dir<'a, T> {
/// Creates directory entries iterator. /// Creates directory entries iterator.
pub fn iter(&self) -> DirIter<'a, T> { pub fn iter(&self) -> DirIter<'a, T> {
self.stream.clone();
DirIter { DirIter {
stream: self.stream.clone(), stream: self.stream.clone(),
fs: self.fs.clone(), fs: self.fs,
err: false, err: false,
} }
} }

View File

@ -240,7 +240,7 @@ impl<'a, T: ReadWriteSeek> Write for File<'a, T> {
if self.first_cluster.is_none() { if self.first_cluster.is_none() {
self.set_first_cluster(new_cluster); 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 // zero new directory cluster
trace!("zeroing directory cluser {}", new_cluster); trace!("zeroing directory cluser {}", new_cluster);
let abs_pos = self.fs.offset_from_cluster(new_cluster); let abs_pos = self.fs.offset_from_cluster(new_cluster);