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,29 +182,29 @@ 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 l2name = l1_entry.file_name(); let file_type = match l1_entry.file_type() {
if l2name.to_bytes_with_nul()[0] == b'.' { continue; } Some(file_type) => file_type,
let mut l2_handle = match Dir::openat( None => bail!("unsupported file system type on {:?}/{:?}", self.chunk_dir, l1name),
l1_fd, l2name, OFlag::O_RDONLY, Mode::empty()) { };
Ok(h) => h, if file_type != nix::dir::Type::Directory { continue; }
Err(err) => bail!(
"unable to open l2 chunk dir {:?}/{:?}/{:?} - {}",
self.chunk_dir, l1name, l2name, err),
};
self.sweep_old_files(&mut l2_handle); let l2name = l1_entry.file_name();
} if l2name.to_bytes_with_nul()[0] == b'.' { continue; }
}
} let mut l2_handle = match Dir::openat(
Err(_) => { /* ignore */ } l1_fd, l2name, OFlag::O_RDONLY, Mode::empty()) {
} Ok(h) => h,
Err(err) => bail!(
"unable to open l2 chunk dir {:?}/{:?}/{:?} - {}",
self.chunk_dir, l1name, l2name, err),
};
self.sweep_old_files(&mut l2_handle);
} }
} }
Ok(()) Ok(())
} }