diff --git a/src/error.rs b/src/error.rs index 5aa53d2..1761996 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,6 +12,7 @@ pub type Result = std::result::Result; /// Wrapper for all errors that can occur in `crossterm`. #[derive(Debug)] +#[non_exhaustive] pub enum ErrorKind { IoError(io::Error), FmtError(fmt::Error), @@ -19,8 +20,6 @@ pub enum ErrorKind { ParseIntError(std::num::ParseIntError), ResizingTerminalFailure(String), SettingTerminalTitleFailure, - #[doc(hidden)] - __Nonexhaustive, } impl std::error::Error for ErrorKind { diff --git a/src/event/filter.rs b/src/event/filter.rs index 5ea4e19..2b7e292 100644 --- a/src/event/filter.rs +++ b/src/event/filter.rs @@ -13,11 +13,7 @@ pub(crate) struct CursorPositionFilter; #[cfg(unix)] impl Filter for CursorPositionFilter { fn eval(&self, event: &InternalEvent) -> bool { - if let InternalEvent::CursorPosition(_, _) = *event { - true - } else { - false - } + matches!(*event, InternalEvent::CursorPosition(_, _)) } } @@ -27,11 +23,7 @@ pub(crate) struct EventFilter; impl Filter for EventFilter { #[cfg(unix)] fn eval(&self, event: &InternalEvent) -> bool { - if let InternalEvent::Event(_) = *event { - true - } else { - false - } + matches!(*event, InternalEvent::Event(_)) } #[cfg(windows)] diff --git a/src/style/types/attribute.rs b/src/style/types/attribute.rs index 8334116..8a6095f 100644 --- a/src/style/types/attribute.rs +++ b/src/style/types/attribute.rs @@ -88,6 +88,7 @@ macro_rules! Attribute { } } +#[non_exhaustive] Attribute! { /// Resets all the attributes. Reset = 0, @@ -139,8 +140,6 @@ Attribute! { NotFramedOrEncircled = 54, /// Turns off the `OverLined` attribute. NotOverLined = 55, - #[doc(hidden)] - __Nonexhaustive = 255, } impl Display for Attribute { diff --git a/src/terminal/sys/unix.rs b/src/terminal/sys/unix.rs index 13b56bd..5fddd62 100644 --- a/src/terminal/sys/unix.rs +++ b/src/terminal/sys/unix.rs @@ -22,7 +22,7 @@ pub(crate) fn is_raw_mode_enabled() -> bool { TERMINAL_MODE_PRIOR_RAW_MODE.lock().unwrap().is_some() } -#[allow(clippy::identity_conversion)] +#[allow(clippy::useless_conversion)] pub(crate) fn size() -> Result<(u16, u16)> { // http://rosettacode.org/wiki/Terminal_control/Dimensions#Library:_BSD_libc let mut size = winsize {