aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2023-03-08 13:02:19 -0500
committerJesse Luehrs <doy@tozt.net>2023-03-08 13:02:19 -0500
commit5997dd043695a2354d4854cd2dcdb7a8cfd0e879 (patch)
treeb3538cd00ed94eda3e2416ea03f5db41f0037e15
parentdcceb025761d379e18111043eb2101e112addb71 (diff)
downloadtextmode-5997dd043695a2354d4854cd2dcdb7a8cfd0e879.tar.gz
textmode-5997dd043695a2354d4854cd2dcdb7a8cfd0e879.zip
clippy
-rw-r--r--src/blocking/input.rs2
-rw-r--r--src/blocking/output.rs2
-rw-r--r--src/error.rs6
-rw-r--r--src/key.rs46
-rw-r--r--src/output.rs2
-rw-r--r--src/private.rs2
6 files changed, 27 insertions, 33 deletions
diff --git a/src/blocking/input.rs b/src/blocking/input.rs
index 63c9ac5..e41e8f1 100644
--- a/src/blocking/input.rs
+++ b/src/blocking/input.rs
@@ -54,8 +54,6 @@ impl RawGuard {
impl Drop for RawGuard {
/// Calls `cleanup`.
fn drop(&mut self) {
- // https://github.com/rust-lang/rust-clippy/issues/8003
- #[allow(clippy::let_underscore_drop)]
let _ = self.cleanup();
}
}
diff --git a/src/blocking/output.rs b/src/blocking/output.rs
index 8d21c41..482a895 100644
--- a/src/blocking/output.rs
+++ b/src/blocking/output.rs
@@ -36,8 +36,6 @@ impl ScreenGuard {
impl Drop for ScreenGuard {
/// Calls `cleanup`.
fn drop(&mut self) {
- // https://github.com/rust-lang/rust-clippy/issues/8003
- #[allow(clippy::let_underscore_drop)]
let _ = self.cleanup();
}
}
diff --git a/src/error.rs b/src/error.rs
index fea92b6..8b99337 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -15,13 +15,13 @@ impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ReadStdin(e) => {
- write!(f, "error reading from stdin: {}", e)
+ write!(f, "error reading from stdin: {e}")
}
Self::SetTerminalMode(e) => {
- write!(f, "error setting terminal mode: {}", e)
+ write!(f, "error setting terminal mode: {e}")
}
Self::WriteStdout(e) => {
- write!(f, "error writing to stdout: {}", e)
+ write!(f, "error writing to stdout: {e}")
}
}
}
diff --git a/src/key.rs b/src/key.rs
index 15c0303..ea0568d 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -35,29 +35,29 @@ impl Key {
#[must_use]
pub fn into_bytes(self) -> Vec<u8> {
match self {
- Key::String(s) => s.into_bytes(),
- Key::Char(c) => c.to_string().into_bytes(),
- Key::Bytes(s) => s,
- Key::Byte(c) => vec![c],
- Key::Ctrl(c) => vec![c - b'a' + 1],
- Key::Meta(c) => vec![b'\x1b', c],
- Key::Backspace => b"\x7f".to_vec(),
- Key::Escape => b"\x1b".to_vec(),
- Key::Up => b"\x1b[A".to_vec(),
- Key::Down => b"\x1b[B".to_vec(),
- Key::Right => b"\x1b[C".to_vec(),
- Key::Left => b"\x1b[D".to_vec(),
- Key::KeypadUp => b"\x1bOA".to_vec(),
- Key::KeypadDown => b"\x1bOB".to_vec(),
- Key::KeypadRight => b"\x1bOC".to_vec(),
- Key::KeypadLeft => b"\x1bOD".to_vec(),
- Key::Home => b"\x1b[H".to_vec(),
- Key::End => b"\x1b[F".to_vec(),
- Key::Insert => b"\x1b[2~".to_vec(),
- Key::Delete => b"\x1b[3~".to_vec(),
- Key::PageUp => b"\x1b[5~".to_vec(),
- Key::PageDown => b"\x1b[6~".to_vec(),
- Key::F(c) => match c {
+ Self::String(s) => s.into_bytes(),
+ Self::Char(c) => c.to_string().into_bytes(),
+ Self::Bytes(s) => s,
+ Self::Byte(c) => vec![c],
+ Self::Ctrl(c) => vec![c - b'a' + 1],
+ Self::Meta(c) => vec![b'\x1b', c],
+ Self::Backspace => b"\x7f".to_vec(),
+ Self::Escape => b"\x1b".to_vec(),
+ Self::Up => b"\x1b[A".to_vec(),
+ Self::Down => b"\x1b[B".to_vec(),
+ Self::Right => b"\x1b[C".to_vec(),
+ Self::Left => b"\x1b[D".to_vec(),
+ Self::KeypadUp => b"\x1bOA".to_vec(),
+ Self::KeypadDown => b"\x1bOB".to_vec(),
+ Self::KeypadRight => b"\x1bOC".to_vec(),
+ Self::KeypadLeft => b"\x1bOD".to_vec(),
+ Self::Home => b"\x1b[H".to_vec(),
+ Self::End => b"\x1b[F".to_vec(),
+ Self::Insert => b"\x1b[2~".to_vec(),
+ Self::Delete => b"\x1b[3~".to_vec(),
+ Self::PageUp => b"\x1b[5~".to_vec(),
+ Self::PageDown => b"\x1b[6~".to_vec(),
+ Self::F(c) => match c {
1 => b"\x1bOP".to_vec(),
2 => b"\x1bOQ".to_vec(),
3 => b"\x1bOR".to_vec(),
diff --git a/src/output.rs b/src/output.rs
index 483de6b..1ac9f43 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -49,9 +49,7 @@ impl Drop for ScreenGuard {
if !self.cleaned_up {
let mut stdout = std::io::stdout();
- #[allow(clippy::let_underscore_drop)]
let _ = stdout.write_all(crate::DEINIT);
- #[allow(clippy::let_underscore_drop)]
let _ = stdout.flush();
}
}
diff --git a/src/private.rs b/src/private.rs
index 87e281c..7de7627 100644
--- a/src/private.rs
+++ b/src/private.rs
@@ -318,7 +318,7 @@ pub trait Input {
}
fn getc(&mut self) -> Option<u8> {
- self.buf().get(0).copied().map(|c| {
+ self.buf().first().copied().map(|c| {
self.consume(1);
c
})