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
use crate::terminal_helpers::*;
@ -251,7 +252,7 @@ impl Editor {
// ------------------------------------------------------------------------
/// Convert stdin to specific keypresses
fn read_key(&mut self) -> Option<KeyCode<char>> {
fn read_key(&mut self) -> Option<KeyCode> {
// --------------------------------------------------------------------
// 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 {