summaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-04-29 18:22:44 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-04-30 11:05:47 -0400
commit36d8299f224b044139d52c0f65eb66be4c25a5d0 (patch)
tree5f99fdfff153ab9f39c1d3ed77f9f18ef3c2d5d3 /src/tab.rs
parent4bbe0969006eab7cfe3a47231d5e002b5259e19b (diff)
cargo clippy
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/tab.rs b/src/tab.rs
index d60c12a..92d7322 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -39,27 +39,25 @@ impl JoshutoTab {
if self.curr_list.path.exists() {
self.curr_list.update_contents(sort_option)?;
}
- match self.curr_list.get_curr_ref() {
- Some(s) => {
- if s.path.is_dir() {
- match self.history.entry(s.path.clone().to_path_buf()) {
- Entry::Occupied(mut entry) => {
- let dirlist = entry.get_mut();
- if dirlist.need_update() {
- dirlist.update_contents(sort_option)?;
- }
- }
- Entry::Vacant(entry) => {
- let s = JoshutoDirList::new(s.path.clone().to_path_buf(), sort_option)?;
- entry.insert(s);
+ if let Some(s) = self.curr_list.get_curr_ref() {
+ if s.path.is_dir() {
+ match self.history.entry(s.path.clone().to_path_buf()) {
+ Entry::Occupied(mut entry) => {
+ let dirlist = entry.get_mut();
+ if dirlist.need_update() {
+ dirlist.update_contents(sort_option)?;
}
}
+ Entry::Vacant(entry) => {
+ let s = JoshutoDirList::new(s.path.clone().to_path_buf(), sort_option)?;
+ entry.insert(s);
+ }
}
}
- None => {}
- };
+ }
+
if let Some(parent) = self.curr_list.path.parent() {
- match self.history.entry(parent.clone().to_path_buf()) {
+ match self.history.entry(parent.to_path_buf().clone()) {
Entry::Occupied(mut entry) => {
let dirlist = entry.get_mut();
if dirlist.need_update() {
@@ -67,7 +65,7 @@ impl JoshutoTab {
}
}
Entry::Vacant(entry) => {
- let s = JoshutoDirList::new(parent.clone().to_path_buf(), sort_option)?;
+ let s = JoshutoDirList::new(parent.to_path_buf().clone(), sort_option)?;
entry.insert(s);
}
}