From 6fcbb99fafd8df81a696496ae241d9217ce1a948 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 22 Dec 2020 10:16:47 +0100 Subject: [PATCH] fix clippy on nightly --- src/components/changes.rs | 22 +++++++++++----------- src/components/filetree.rs | 21 ++++++++++----------- src/components/utils/statustree.rs | 19 +++++++++---------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/components/changes.rs b/src/components/changes.rs index 9771ae97..3631883a 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -87,21 +87,21 @@ impl ChangesComponent { _ => sync::stage_add_file(CWD, path)?, }; - return Ok(true); - } else { - //TODO: check if we can handle the one file case with it aswell - sync::stage_add_all( - CWD, - tree_item.info.full_path.as_str(), - )?; - return Ok(true); } - } else { - let path = tree_item.info.full_path.as_str(); - sync::reset_stage(CWD, path)?; + + //TODO: check if we can handle the one file case with it aswell + sync::stage_add_all( + CWD, + tree_item.info.full_path.as_str(), + )?; + return Ok(true); } + + let path = tree_item.info.full_path.as_str(); + sync::reset_stage(CWD, path)?; + return Ok(true); } Ok(false) diff --git a/src/components/filetree.rs b/src/components/filetree.rs index 6cdfe45d..0e200664 100644 --- a/src/components/filetree.rs +++ b/src/components/filetree.rs @@ -274,18 +274,17 @@ impl FileTreeComponent { { should_skip_over -= 1; break; - } else { - // There is only one item at this level (i.e only one folder in the folder), - // so do fold up + } - let vec_draw_text_info_len = - vec_draw_text_info.len(); - vec_draw_text_info[vec_draw_text_info_len - 1] - .name += &(String::from("/") - + &tree_items[idx_temp].info.path); - if index_above_select { - selection_offset += 1; - } + // There is only one item at this level (i.e only one folder in the folder), + // so do fold up + + let vec_draw_text_info_len = vec_draw_text_info.len(); + vec_draw_text_info[vec_draw_text_info_len - 1] + .name += &(String::from("/") + + &tree_items[idx_temp].info.path); + if index_above_select { + selection_offset += 1; } } } diff --git a/src/components/utils/statustree.rs b/src/components/utils/statustree.rs index 61f2f9bc..f3cdee16 100644 --- a/src/components/utils/statustree.rs +++ b/src/components/utils/statustree.rs @@ -215,15 +215,15 @@ impl StatusTree { { current_index_in_available_selections = pos; break; - } else { - // Find the closest to the index, usually this shouldn't happen - if current_index == 0 { - // This should never happen - current_index_in_available_selections = 0; - break; - } - cur_index_find -= 1; } + + // Find the closest to the index, usually this shouldn't happen + if current_index == 0 { + // This should never happen + current_index_in_available_selections = 0; + break; + } + cur_index_find -= 1; } } @@ -398,9 +398,8 @@ impl StatusTree { } // we are still in a collapsed inner path continue; - } else { - inner_collapsed = None; } + inner_collapsed = None; } let item_kind = self.tree[i].kind.clone();