Slighly improve readability of Hasher::hash_root

type: reform
This commit is contained in:
Casey Rodarmor 2020-01-20 21:53:24 -08:00
parent 1f5b829742
commit 1749fce2b2
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0

View File

@ -32,12 +32,9 @@ impl Hasher {
}
fn hash_root(mut self, root: &Path) -> Result<(Mode, Vec<u8>), Error> {
let single = root
.metadata()
.context(error::Filesystem { path: root })?
.is_file();
let metadata = root.metadata().context(error::Filesystem { path: root })?;
if single {
if metadata.is_file() {
let (md5sum, length) = self.hash_file(&root)?;
if self.piece_bytes_hashed > 0 {