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 {