From ddf0963c65c52c5cc98ea68c4b094457203ac79c Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 4 Mar 2021 15:25:37 -0500 Subject: [PATCH] Some minor cleanup --- src/editor.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index 4466c7f..da5dabc 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -1,3 +1,4 @@ +#![forbid(unsafe_code)] //! Editor functionality use crate::terminal_helpers::*; @@ -251,7 +252,7 @@ impl Editor { // ------------------------------------------------------------------------ /// Convert stdin to specific keypresses - fn read_key(&mut self) -> Option> { + fn read_key(&mut self) -> Option { // -------------------------------------------------------------------- // Match single character // -------------------------------------------------------------------- @@ -669,10 +670,9 @@ impl Editor { let mut buffer = String::new(); let default_cb = &mut Self::_noop_prompt_cb; - let cb = if cb.is_some() { - cb.unwrap() - } else { - default_cb + let cb = match cb { + Some(cb) => cb, + None => default_cb, }; loop {