summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-05-29 22:55:06 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-05-29 22:55:06 -0400
commit5d8525a9cc8a61e8e66a92f66132ad11ce112ff7 (patch)
treef6881d9699070c4265710cab5e807db2c0def7bb
parent459155dc755be747076d7b71b151f1239b0caa1d (diff)
clean up code style
-rw-r--r--src/history.rs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/history.rs b/src/history.rs
index 0f604c3..7c6076f 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -26,26 +26,24 @@ impl DirectoryHistory for JoshutoHistory {
let mut ancestors = pathbuf.ancestors();
match ancestors.next() {
None => {}
- Some(mut ancestor) => {
- for curr in ancestors {
- match JoshutoDirList::new(curr.to_path_buf().clone(), sort_option) {
- Ok(mut s) => {
- let index = s.contents.iter().enumerate().find_map(|(i, dir)| {
- if dir.path == ancestor {
- Some(i)
- } else {
- None
- }
- });
- if let Some(i) = index {
- s.index = Some(i);
+ Some(mut ancestor) => for curr in ancestors {
+ match JoshutoDirList::new(curr.to_path_buf().clone(), sort_option) {
+ Ok(mut s) => {
+ let index = s.contents.iter().enumerate().find_map(|(i, dir)| {
+ if dir.path == ancestor {
+ Some(i)
+ } else {
+ None
}
- self.insert(curr.to_path_buf(), s);
+ });
+ if let Some(i) = index {
+ s.index = Some(i);
}
- Err(e) => eprintln!("populate_to_root: {}", e),
+ self.insert(curr.to_path_buf(), s);
}
- ancestor = curr;
+ Err(e) => eprintln!("populate_to_root: {}", e),
}
+ ancestor = curr;
}
}
}