diff options
author | Alex Auvolat <alex@adnab.me> | 2022-07-08 10:16:46 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-07-08 10:16:46 +0200 |
commit | 4312623930efda3099474569c05a086ef1d02998 (patch) | |
tree | 41e7d63a71dbb7747cfae25c763d8d31295fd72b | |
parent | 4cc9a648abbc5434aee17f568525499340b5df3d (diff) | |
download | garage-4312623930efda3099474569c05a086ef1d02998.tar.gz garage-4312623930efda3099474569c05a086ef1d02998.zip |
whoops and small refactoring
-rw-r--r-- | src/block/repair.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/block/repair.rs b/src/block/repair.rs index 2c21cfd6..26d1bd8f 100644 --- a/src/block/repair.rs +++ b/src/block/repair.rs @@ -415,11 +415,6 @@ impl BlockStoreIterator { ReadingDir::Pending(_) => unreachable!(), }; - if *pos >= subpaths.len() { - self.path.pop(); - continue; - } - let data_dir_ent = match subpaths.get(*pos) { None => { self.path.pop(); @@ -444,14 +439,11 @@ impl BlockStoreIterator { let path = data_dir_ent.path(); self.path.push(ReadingDir::Pending(path)); } else if name.len() == 64 { - let hash_bytes = if let Ok(h) = hex::decode(&name) { - h - } else { - continue; - }; - let mut hash = [0u8; 32]; - hash.copy_from_slice(&hash_bytes[..]); - return Ok(Some(hash.into())); + if let Ok(h) = hex::decode(&name) { + let mut hash = [0u8; 32]; + hash.copy_from_slice(&h); + return Ok(Some(hash.into())); + } } } } |