summaryrefslogtreecommitdiffstats
path: root/src/commands/cursor_move.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-04-22 20:51:55 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-04-22 20:51:55 -0400
commit043a118903e4f7981c4e6c1193406de798c1d9e6 (patch)
tree868b86477d912708c88571152cc42886ed9d6bf9 /src/commands/cursor_move.rs
parent1440bb47b469414b82180ddca31392befee5b209 (diff)
code cleanup
Diffstat (limited to 'src/commands/cursor_move.rs')
-rw-r--r--src/commands/cursor_move.rs26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/commands/cursor_move.rs b/src/commands/cursor_move.rs
index ec80c0d..467377f 100644
--- a/src/commands/cursor_move.rs
+++ b/src/commands/cursor_move.rs
@@ -70,11 +70,8 @@ impl JoshutoRunnable for CursorMoveInc {
view: &JoshutoView,
) -> Result<(), JoshutoError> {
let mut movement: Option<usize> = None;
- {
- let curr_tab = context.curr_tab_mut();
- if let Some(curr_list) = curr_tab.curr_list.as_ref() {
- movement = curr_list.index.map(|x| x + self.movement);
- }
+ if let Some(curr_list) = context.curr_tab_mut().curr_list.as_ref() {
+ movement = curr_list.index.map(|x| x + self.movement);
}
if let Some(s) = movement {
CursorMove::cursor_move(s, context, view)
@@ -112,17 +109,14 @@ impl JoshutoRunnable for CursorMoveDec {
view: &JoshutoView,
) -> Result<(), JoshutoError> {
let mut movement: Option<usize> = None;
- {
- let curr_tab = context.curr_tab_mut();
- if let Some(curr_list) = curr_tab.curr_list.as_ref() {
- movement = curr_list.index.map(|x| {
- if x > self.movement {
- x - self.movement
- } else {
- 0
- }
- });
- }
+ if let Some(curr_list) = context.curr_tab_mut().curr_list.as_ref() {
+ movement = curr_list.index.map(|x| {
+ if x > self.movement {
+ x - self.movement
+ } else {
+ 0
+ }
+ });
}
if let Some(s) = movement {
CursorMove::cursor_move(s, context, view);