Skip to content

Commit

Permalink
Merge pull request #364 from gwenn/non_exhaustive
Browse files Browse the repository at this point in the history
Make some enums non_exhaustive
  • Loading branch information
gwenn authored Apr 13, 2020
2 parents b5c2e0f + a130fef commit 0e26273
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -199,13 +200,15 @@ pub enum CompletionType {

/// Style of editing / Standard keymaps
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum EditMode {
Emacs,
Vi,
}

/// Colorization mode
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum ColorMode {
Enabled,
Forced,
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/keys.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Key constants
// #[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum KeyPress {
UnknownEscSeq,
Backspace, // Ctrl('H')
Expand Down

0 comments on commit 0e26273

Please sign in to comment.