cleanup - avoid too much indentation

This commit is contained in:
Dietmar Maurer 2018-12-19 12:40:26 +01:00
parent 1c43c56b06
commit 6c20a13d3c
1 changed files with 20 additions and 20 deletions

View File

@ -182,12 +182,19 @@ impl ChunkStore {
let l1_fd = l1_handle.as_raw_fd(); let l1_fd = l1_handle.as_raw_fd();
for l1_entry in l1_handle.iter() { for l1_entry in l1_handle.iter() {
match l1_entry { let l1_entry = match l1_entry {
Ok(l1_entry) => { Ok(l1_entry) => l1_entry,
if let Some(file_type) = l1_entry.file_type() { Err(_) => continue /* ignore errors? */,
if file_type == nix::dir::Type::Directory { };
let file_type = match l1_entry.file_type() {
Some(file_type) => file_type,
None => bail!("unsupported file system type on {:?}/{:?}", self.chunk_dir, l1name),
};
if file_type != nix::dir::Type::Directory { continue; }
let l2name = l1_entry.file_name(); let l2name = l1_entry.file_name();
if l2name.to_bytes_with_nul()[0] == b'.' { continue; } if l2name.to_bytes_with_nul()[0] == b'.' { continue; }
let mut l2_handle = match Dir::openat( let mut l2_handle = match Dir::openat(
l1_fd, l2name, OFlag::O_RDONLY, Mode::empty()) { l1_fd, l2name, OFlag::O_RDONLY, Mode::empty()) {
Ok(h) => h, Ok(h) => h,
@ -195,16 +202,9 @@ impl ChunkStore {
"unable to open l2 chunk dir {:?}/{:?}/{:?} - {}", "unable to open l2 chunk dir {:?}/{:?}/{:?} - {}",
self.chunk_dir, l1name, l2name, err), self.chunk_dir, l1name, l2name, err),
}; };
self.sweep_old_files(&mut l2_handle); self.sweep_old_files(&mut l2_handle);
} }
} }
}
Err(_) => { /* ignore */ }
}
}
}
Ok(()) Ok(())
} }