diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-05-06 21:15:30 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-05-06 21:15:30 -0400 |
commit | 58e816e87afdf29bc29774f3f206fe169637dddc (patch) | |
tree | 192cfb79d236672b4be2135b689df2cdf9cd5c01 | |
parent | cc7570f34586da8773beab31c3baedce8072971a (diff) |
fix clippy
-rw-r--r-- | src/commands/commands.rs | 4 | ||||
-rw-r--r-- | src/util/input.rs | 8 |
2 files changed, 2 insertions, 10 deletions
diff --git a/src/commands/commands.rs b/src/commands/commands.rs index af0815a..ddda0ec 100644 --- a/src/commands/commands.rs +++ b/src/commands/commands.rs @@ -127,8 +127,8 @@ impl KeyCommand { } pub fn parse_command(s: &str) -> JoshutoResult<Self> { - if s.starts_with(':') { - return Ok(Self::CommandLine(s[1..].to_owned(), "".to_owned())); + if let Some(stripped) = s.strip_prefix(':') { + return Ok(Self::CommandLine(stripped.to_owned(), "".to_owned())); } let (command, arg) = match s.find(' ') { diff --git a/src/util/input.rs b/src/util/input.rs index a9ab3e8..a68d9dd 100644 --- a/src/util/input.rs +++ b/src/util/input.rs @@ -34,10 +34,6 @@ pub fn process_mouse(event: MouseEvent, context: &mut AppContext, backend: &mut } } else { // TODO: scroll in child list - let command = KeyCommand::CursorMoveUp(1); - if let Err(e) = command.execute(context, backend) { - context.push_msg(e.to_string()); - } } } MouseEvent::Press(MouseButton::WheelDown, x, _) => { @@ -53,10 +49,6 @@ pub fn process_mouse(event: MouseEvent, context: &mut AppContext, backend: &mut } } else { // TODO: scroll in child list - let command = KeyCommand::CursorMoveDown(1); - if let Err(e) = command.execute(context, backend) { - context.push_msg(e.to_string()); - } } } MouseEvent::Press(MouseButton::Left, x, y) |