From 9dcf3da5e75031f1c35cdfb0ddd905b3ca090d90 Mon Sep 17 00:00:00 2001 From: Razvan Rus Date: Sat, 20 Jan 2024 13:30:08 +0200 Subject: [PATCH 1/2] -2 lines --- src/editor.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index fe3c1e13..7fecae0d 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -842,9 +842,7 @@ fn process_prompt_keypress(mut buffer: String, key: &Key) -> PromptState { match key { Key::Char(b'\r') => return PromptState::Completed(buffer), Key::Escape | Key::Char(EXIT) => return PromptState::Cancelled, - Key::Char(BACKSPACE | DELETE_BIS) => { - buffer.pop(); - } + Key::Char(BACKSPACE | DELETE_BIS) => _ = buffer.pop(), Key::Char(c @ 0..=126) if !c.is_ascii_control() => buffer.push(*c as char), // No-op _ => (), From 08f792f959064645f7d207f747bf80da440d4b88 Mon Sep 17 00:00:00 2001 From: Razvan Rus Date: Sat, 20 Jan 2024 13:59:17 +0200 Subject: [PATCH 2/2] modified macro, -2 lines --- src/editor.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index 7fecae0d..a5ecfc49 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -28,9 +28,7 @@ const HELP_MESSAGE: &str = /// `set_status!` sets a formatted status message for the editor. /// Example usage: `set_status!(editor, "{} written to {}", file_size, file_name)` -macro_rules! set_status { - ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) -} +macro_rules! set_status { ($editor:expr, $($arg:expr),*) => ($editor.status_msg = Some(StatusMessage::new(format!($($arg),*)))) } /// Enum of input keys enum Key {