Skip to content

Commit

Permalink
Slighly improve readability of Hasher::hash_root
Browse files Browse the repository at this point in the history
type: reform
  • Loading branch information
casey committed Apr 8, 2020
1 parent 1f5b829 commit 1749fce
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1749fce

Please sign in to comment.