Fix clippy warnings (#477)
This commit is contained in:
parent
27a9d7d521
commit
7732861e4d
@ -12,6 +12,7 @@ pub type Result<T> = std::result::Result<T, ErrorKind>;
|
|||||||
|
|
||||||
/// Wrapper for all errors that can occur in `crossterm`.
|
/// Wrapper for all errors that can occur in `crossterm`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum ErrorKind {
|
pub enum ErrorKind {
|
||||||
IoError(io::Error),
|
IoError(io::Error),
|
||||||
FmtError(fmt::Error),
|
FmtError(fmt::Error),
|
||||||
@ -19,8 +20,6 @@ pub enum ErrorKind {
|
|||||||
ParseIntError(std::num::ParseIntError),
|
ParseIntError(std::num::ParseIntError),
|
||||||
ResizingTerminalFailure(String),
|
ResizingTerminalFailure(String),
|
||||||
SettingTerminalTitleFailure,
|
SettingTerminalTitleFailure,
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for ErrorKind {
|
impl std::error::Error for ErrorKind {
|
||||||
|
@ -13,11 +13,7 @@ pub(crate) struct CursorPositionFilter;
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
impl Filter for CursorPositionFilter {
|
impl Filter for CursorPositionFilter {
|
||||||
fn eval(&self, event: &InternalEvent) -> bool {
|
fn eval(&self, event: &InternalEvent) -> bool {
|
||||||
if let InternalEvent::CursorPosition(_, _) = *event {
|
matches!(*event, InternalEvent::CursorPosition(_, _))
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,11 +23,7 @@ pub(crate) struct EventFilter;
|
|||||||
impl Filter for EventFilter {
|
impl Filter for EventFilter {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn eval(&self, event: &InternalEvent) -> bool {
|
fn eval(&self, event: &InternalEvent) -> bool {
|
||||||
if let InternalEvent::Event(_) = *event {
|
matches!(*event, InternalEvent::Event(_))
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -88,6 +88,7 @@ macro_rules! Attribute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
Attribute! {
|
Attribute! {
|
||||||
/// Resets all the attributes.
|
/// Resets all the attributes.
|
||||||
Reset = 0,
|
Reset = 0,
|
||||||
@ -139,8 +140,6 @@ Attribute! {
|
|||||||
NotFramedOrEncircled = 54,
|
NotFramedOrEncircled = 54,
|
||||||
/// Turns off the `OverLined` attribute.
|
/// Turns off the `OverLined` attribute.
|
||||||
NotOverLined = 55,
|
NotOverLined = 55,
|
||||||
#[doc(hidden)]
|
|
||||||
__Nonexhaustive = 255,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Attribute {
|
impl Display for Attribute {
|
||||||
|
@ -22,7 +22,7 @@ pub(crate) fn is_raw_mode_enabled() -> bool {
|
|||||||
TERMINAL_MODE_PRIOR_RAW_MODE.lock().unwrap().is_some()
|
TERMINAL_MODE_PRIOR_RAW_MODE.lock().unwrap().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::identity_conversion)]
|
#[allow(clippy::useless_conversion)]
|
||||||
pub(crate) fn size() -> Result<(u16, u16)> {
|
pub(crate) fn size() -> Result<(u16, u16)> {
|
||||||
// http://rosettacode.org/wiki/Terminal_control/Dimensions#Library:_BSD_libc
|
// http://rosettacode.org/wiki/Terminal_control/Dimensions#Library:_BSD_libc
|
||||||
let mut size = winsize {
|
let mut size = winsize {
|
||||||
|
Loading…
Reference in New Issue
Block a user