diff --git a/src/bundledb/db.rs b/src/bundledb/db.rs index 740f3d6..5e704fc 100644 --- a/src/bundledb/db.rs +++ b/src/bundledb/db.rs @@ -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 { - 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 { - 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()) } diff --git a/src/repository/backup.rs b/src/repository/backup.rs index 84103e1..c3562c4 100644 --- a/src/repository/backup.rs +++ b/src/repository/backup.rs @@ -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)); } } diff --git a/src/repository/basic_io.rs b/src/repository/basic_io.rs index 7f0ec30..78383b7 100644 --- a/src/repository/basic_io.rs +++ b/src/repository/basic_io.rs @@ -201,7 +201,7 @@ impl Repository { pub fn get_stream(&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)); } diff --git a/src/repository/integrity.rs b/src/repository/integrity.rs index 8a5d563..bec4faf 100644 --- a/src/repository/integrity.rs +++ b/src/repository/integrity.rs @@ -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(()) } diff --git a/src/repository/metadata.rs b/src/repository/metadata.rs index e18013c..5e5b54e 100644 --- a/src/repository/metadata.rs +++ b/src/repository/metadata.rs @@ -249,7 +249,7 @@ impl Inode { #[inline] pub fn decode(data: &[u8]) -> Result { - 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));