Some minor cleanup

This commit is contained in:
Timothy Warren 2021-03-04 15:25:37 -05:00
parent 44a1d5ce9a
commit ddf0963c65

View File

@ -1,3 +1,4 @@
#![forbid(unsafe_code)]
//! Editor functionality //! Editor functionality
use crate::terminal_helpers::*; use crate::terminal_helpers::*;
@ -251,7 +252,7 @@ impl Editor {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/// Convert stdin to specific keypresses /// Convert stdin to specific keypresses
fn read_key(&mut self) -> Option<KeyCode<char>> { fn read_key(&mut self) -> Option<KeyCode> {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Match single character // Match single character
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@ -669,10 +670,9 @@ impl Editor {
let mut buffer = String::new(); let mut buffer = String::new();
let default_cb = &mut Self::_noop_prompt_cb; let default_cb = &mut Self::_noop_prompt_cb;
let cb = if cb.is_some() { let cb = match cb {
cb.unwrap() Some(cb) => cb,
} else { None => default_cb,
default_cb
}; };
loop { loop {