diff --git a/src/ansi.rs b/src/ansi.rs index 3a3c96c3..bc54b6d0 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -142,7 +142,7 @@ impl<'a> Iterator for Matches<'a> { } } -impl<'a> FusedIterator for Matches<'a> {} +impl FusedIterator for Matches<'_> {} fn find_ansi_code_exclusive(it: &mut Peekable) -> Option<(usize, usize)> { 'outer: loop { @@ -265,7 +265,7 @@ impl<'a> Iterator for AnsiCodeIterator<'a> { } } -impl<'a> FusedIterator for AnsiCodeIterator<'a> {} +impl FusedIterator for AnsiCodeIterator<'_> {} #[cfg(test)] mod tests { @@ -284,7 +284,7 @@ mod tests { .unwrap(); } - impl<'a, 'b> PartialEq> for regex::Match<'b> { + impl<'a> PartialEq> for regex::Match<'_> { fn eq(&self, other: &Match<'a>) -> bool { self.start() == other.start && self.end() == other.end } diff --git a/src/term.rs b/src/term.rs index 44e94055..f64607f4 100644 --- a/src/term.rs +++ b/src/term.rs @@ -62,7 +62,7 @@ pub enum TermFamily { #[derive(Debug, Clone)] pub struct TermFeatures<'a>(&'a Term); -impl<'a> TermFeatures<'a> { +impl TermFeatures<'_> { /// Check if this is a real user attended terminal (`isatty`) #[inline] pub fn is_attended(&self) -> bool { @@ -630,7 +630,7 @@ impl Write for Term { } } -impl<'a> Write for &'a Term { +impl Write for &Term { fn write(&mut self, buf: &[u8]) -> io::Result { match self.inner.buffer { Some(ref buffer) => buffer.lock().unwrap().write_all(buf), @@ -650,7 +650,7 @@ impl Read for Term { } } -impl<'a> Read for &'a Term { +impl Read for &Term { fn read(&mut self, buf: &mut [u8]) -> io::Result { io::stdin().read(buf) } diff --git a/src/utils.rs b/src/utils.rs index cfecc78f..be998a38 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -696,7 +696,7 @@ impl<'a, 'b> Emoji<'a, 'b> { } } -impl<'a, 'b> fmt::Display for Emoji<'a, 'b> { +impl fmt::Display for Emoji<'_, '_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if wants_emoji() { write!(f, "{}", self.0) diff --git a/src/windows_term/colors.rs b/src/windows_term/colors.rs index dc8209de..237349a3 100644 --- a/src/windows_term/colors.rs +++ b/src/windows_term/colors.rs @@ -12,6 +12,7 @@ use windows_sys::Win32::System::Console::{ use crate::Term; +#[allow(clippy::upper_case_acronyms)] type WORD = u16; const FG_CYAN: WORD = FG_BLUE | FG_GREEN; @@ -115,7 +116,7 @@ impl Console { let info = screen_buffer_info(h)?; let attr = TextAttributes::from_word(info.attributes()); Ok(Console { - kind: kind, + kind, start_attr: attr, cur_attr: attr, }) @@ -185,7 +186,7 @@ struct TextAttributes { } impl TextAttributes { - fn to_word(&self) -> WORD { + fn to_word(self) -> WORD { let mut w = 0; w |= self.fg_color.to_fg(); w |= self.fg_intense.to_fg(); @@ -213,7 +214,7 @@ pub enum Intense { } impl Intense { - fn to_bg(&self) -> WORD { + fn to_bg(self) -> WORD { self.to_fg() << 4 } @@ -221,8 +222,8 @@ impl Intense { Intense::from_fg(word >> 4) } - fn to_fg(&self) -> WORD { - match *self { + fn to_fg(self) -> WORD { + match self { Intense::No => 0, Intense::Yes => FG_INTENSITY, } @@ -252,7 +253,7 @@ pub enum Color { } impl Color { - fn to_bg(&self) -> WORD { + fn to_bg(self) -> WORD { self.to_fg() << 4 } @@ -260,8 +261,8 @@ impl Color { Color::from_fg(word >> 4) } - fn to_fg(&self) -> WORD { - match *self { + fn to_fg(self) -> WORD { + match self { Color::Black => 0, Color::Blue => FG_BLUE, Color::Green => FG_GREEN, diff --git a/src/windows_term/mod.rs b/src/windows_term/mod.rs index 173f3ef5..0e220690 100644 --- a/src/windows_term/mod.rs +++ b/src/windows_term/mod.rs @@ -18,8 +18,8 @@ use windows_sys::Win32::System::Console::{ FillConsoleOutputAttribute, FillConsoleOutputCharacterA, GetConsoleCursorInfo, GetConsoleMode, GetConsoleScreenBufferInfo, GetNumberOfConsoleInputEvents, GetStdHandle, ReadConsoleInputW, SetConsoleCursorInfo, SetConsoleCursorPosition, SetConsoleMode, SetConsoleTitleW, - CONSOLE_CURSOR_INFO, CONSOLE_SCREEN_BUFFER_INFO, COORD, INPUT_RECORD, KEY_EVENT, - KEY_EVENT_RECORD, STD_ERROR_HANDLE, STD_HANDLE, STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, + CONSOLE_CURSOR_INFO, CONSOLE_SCREEN_BUFFER_INFO, COORD, INPUT_RECORD, INPUT_RECORD_0, + KEY_EVENT, KEY_EVENT_RECORD, STD_ERROR_HANDLE, STD_HANDLE, STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, }; use windows_sys::Win32::UI::Input::KeyboardAndMouse::VIRTUAL_KEY; @@ -490,7 +490,7 @@ fn read_key_event() -> io::Result { continue; } - key_event = unsafe { mem::transmute(buffer.Event) }; + key_event = unsafe { mem::transmute::(buffer.Event) }; if key_event.bKeyDown == 0 { // This is a key being released; ignore it.