mirror of https://github.com/dswd/zvault
Clippy
This commit is contained in:
parent
43e86f31de
commit
c2bf23d8d7
|
@ -255,13 +255,13 @@ impl BundleDb {
|
|||
let id = bundle.id();
|
||||
let (folder, filename) = self.layout.local_bundle_path(&id, self.local_bundles.len());
|
||||
try!(fs::create_dir_all(&folder).context(&folder as &Path));
|
||||
let bundle = try!(bundle.copy_to(self.layout.base_path(), folder.join(filename)));
|
||||
let bundle = try!(bundle.copy_to(&self.layout.base_path(), folder.join(filename)));
|
||||
self.local_bundles.insert(id, bundle);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn add_bundle(&mut self, bundle: BundleWriter) -> Result<BundleInfo, BundleDbError> {
|
||||
let mut bundle = try!(bundle.finish(self));
|
||||
let mut bundle = try!(bundle.finish(&self));
|
||||
if bundle.info.mode == BundleMode::Meta {
|
||||
try!(self.copy_remote_bundle_to_cache(&bundle))
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ impl BundleDb {
|
|||
}
|
||||
|
||||
pub fn get_chunk_list(&self, bundle: &BundleId) -> Result<ChunkList, BundleDbError> {
|
||||
let mut bundle = try!(self.get_stored_bundle(bundle).and_then(|stored| self.get_bundle(stored)));
|
||||
let mut bundle = try!(self.get_stored_bundle(bundle).and_then(|stored| self.get_bundle(&stored)));
|
||||
Ok(try!(bundle.get_chunk_list()).clone())
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ impl Repository {
|
|||
if inode.file_type == FileType::Directory {
|
||||
let path = path.join(inode.name);
|
||||
for chunks in inode.children.unwrap().values() {
|
||||
let inode = try!(self.get_inode(chunks));
|
||||
let inode = try!(self.get_inode(&chunks));
|
||||
queue.push_back((path.clone(), inode));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ impl Repository {
|
|||
|
||||
pub fn get_stream<W: Write>(&mut self, chunks: &[Chunk], w: &mut W) -> Result<(), RepositoryError> {
|
||||
for &(ref hash, len) in chunks {
|
||||
let data = try!(try!(self.get_chunk(*hash)).ok_or_else(|| IntegrityError::MissingChunk(*hash)));
|
||||
let data = try!(try!(self.get_chunk(*hash)).ok_or_else(|| IntegrityError::MissingChunk(hash.clone())));
|
||||
debug_assert_eq!(data.len() as u32, len);
|
||||
try!(w.write_all(&data));
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ impl Repository {
|
|||
},
|
||||
Some(FileData::ChunkedIndirect(ref chunks)) => {
|
||||
if try!(self.check_chunks(checked, chunks, true)) {
|
||||
let chunk_data = try!(self.get_data(chunks));
|
||||
let chunk_data = try!(self.get_data(&chunks));
|
||||
let chunks = ChunkList::read_from(&chunk_data);
|
||||
try!(self.check_chunks(checked, &chunks, true));
|
||||
}
|
||||
|
@ -191,12 +191,12 @@ impl Repository {
|
|||
try!(self.flush());
|
||||
backup.root = chunks;
|
||||
backup.modified = true;
|
||||
try!(self.evacuate_broken_backup(name));
|
||||
try!(self.save_backup(backup, name));
|
||||
try!(self.evacuate_broken_backup(&name));
|
||||
try!(self.save_backup(&backup, &name));
|
||||
},
|
||||
Err(err) => if repair {
|
||||
warn!("The root of the backup {} has been corrupted\n\tcaused by: {}", name, err);
|
||||
try!(self.evacuate_broken_backup(name));
|
||||
try!(self.evacuate_broken_backup(&name));
|
||||
} else {
|
||||
return Err(err)
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ impl Repository {
|
|||
};
|
||||
info!("Checking inode...");
|
||||
let mut checked = Bitmap::new(self.index.capacity());
|
||||
let mut inodes = try!(self.get_backup_path(backup, path));
|
||||
let mut inodes = try!(self.get_backup_path(&backup, path));
|
||||
let mut inode = inodes.pop().unwrap();
|
||||
let mut modified = false;
|
||||
if let Err(err) = self.check_inode_contents(&inode, &mut checked) {
|
||||
|
@ -260,8 +260,8 @@ impl Repository {
|
|||
try!(self.flush());
|
||||
backup.root = chunks;
|
||||
backup.modified = true;
|
||||
try!(self.evacuate_broken_backup(name));
|
||||
try!(self.save_backup(backup, name));
|
||||
try!(self.evacuate_broken_backup(&name));
|
||||
try!(self.save_backup(&backup, &name));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ impl Inode {
|
|||
|
||||
#[inline]
|
||||
pub fn decode(data: &[u8]) -> Result<Self, InodeError> {
|
||||
Ok(try!(msgpack::decode(data)))
|
||||
Ok(try!(msgpack::decode(&data)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ impl Repository {
|
|||
if let Some(ref contents) = inode.data {
|
||||
match *contents {
|
||||
FileData::Inline(ref data) => {
|
||||
try!(file.write_all(data));
|
||||
try!(file.write_all(&data));
|
||||
},
|
||||
FileData::ChunkedDirect(ref chunks) => {
|
||||
try!(self.get_stream(chunks, &mut file));
|
||||
|
|
Loading…
Reference in New Issue