From a130fef9a32fd84b24ab732888f012f34e194aa0 Mon Sep 17 00:00:00 2001 From: gwenn Date: Mon, 13 Apr 2020 15:22:18 +0200 Subject: [PATCH] Make some enums non_exhaustive --- src/config.rs | 4 ++++ src/error.rs | 1 + src/keymap.rs | 3 ++- src/keys.rs | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index fd4e693c55..ec52d4225d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -181,6 +181,7 @@ pub enum HistoryDuplicates { } #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum CompletionType { /// Complete the next full match (like in Vim by default) Circular, @@ -199,6 +200,7 @@ pub enum CompletionType { /// Style of editing / Standard keymaps #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum EditMode { Emacs, Vi, @@ -206,6 +208,7 @@ pub enum EditMode { /// Colorization mode #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum ColorMode { Enabled, Forced, @@ -215,6 +218,7 @@ pub enum ColorMode { /// Should the editor use stdout or stderr // TODO console term::TermTarget #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum OutputStreamType { Stderr, Stdout, diff --git a/src/error.rs b/src/error.rs index f19600b906..2eac77b3cf 100644 --- a/src/error.rs +++ b/src/error.rs @@ -10,6 +10,7 @@ use std::io; // #[non_exhaustive] #[allow(clippy::module_name_repetitions)] #[derive(Debug)] +#[non_exhaustive] pub enum ReadlineError { /// I/O Error Io(io::Error), diff --git a/src/keymap.rs b/src/keymap.rs index abc1022966..942b39f7ce 100644 --- a/src/keymap.rs +++ b/src/keymap.rs @@ -14,8 +14,8 @@ use crate::tty::{RawReader, Term, Terminal}; pub type RepeatCount = usize; /// Commands -// #[non_exhaustive] #[derive(Debug, Clone, PartialEq)] +#[non_exhaustive] pub enum Cmd { /// abort Abort, // Miscellaneous Command @@ -233,6 +233,7 @@ impl CharSearch { /// Where to move #[derive(Debug, Clone, PartialEq)] +#[non_exhaustive] pub enum Movement { WholeLine, // not really a movement /// beginning-of-line diff --git a/src/keys.rs b/src/keys.rs index 72876d8f6a..34b3b66aca 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -1,7 +1,7 @@ //! Key constants -// #[non_exhaustive] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[non_exhaustive] pub enum KeyPress { UnknownEscSeq, Backspace, // Ctrl('H')