diff options
| author | mo8it <mo8it@proton.me> | 2024-10-17 14:44:48 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-10-17 14:49:07 +0200 |
| commit | 99496706c5041affdc252649bfc74d50a2187271 (patch) | |
| tree | a05c04748a3386857f45cec581a12dd9ae20cb0f | |
| parent | f146553dead78357cd44736dfca97b1349418fa2 (diff) | |
Apply new Clippy lints
| -rw-r--r-- | src/cmd.rs | 2 | ||||
| -rw-r--r-- | src/term.rs | 24 |
2 files changed, 13 insertions, 13 deletions
@@ -125,7 +125,7 @@ pub struct CargoSubcommand<'out> { output: Option<&'out mut Vec<u8>>, } -impl<'out> CargoSubcommand<'out> { +impl CargoSubcommand<'_> { #[inline] pub fn args<'arg, I>(&mut self, args: I) -> &mut Self where diff --git a/src/term.rs b/src/term.rs index e3bfd7b..cb0a07c 100644 --- a/src/term.rs +++ b/src/term.rs @@ -11,15 +11,15 @@ use std::{ use crate::app_state::CheckProgress; -pub struct MaxLenWriter<'a, 'b> { - pub stdout: &'a mut StdoutLock<'b>, +pub struct MaxLenWriter<'a, 'lock> { + pub stdout: &'a mut StdoutLock<'lock>, len: usize, max_len: usize, } -impl<'a, 'b> MaxLenWriter<'a, 'b> { +impl<'a, 'lock> MaxLenWriter<'a, 'lock> { #[inline] - pub fn new(stdout: &'a mut StdoutLock<'b>, max_len: usize) -> Self { + pub fn new(stdout: &'a mut StdoutLock<'lock>, max_len: usize) -> Self { Self { stdout, len: 0, @@ -34,13 +34,13 @@ impl<'a, 'b> MaxLenWriter<'a, 'b> { } } -pub trait CountedWrite<'a> { +pub trait CountedWrite<'lock> { fn write_ascii(&mut self, ascii: &[u8]) -> io::Result<()>; fn write_str(&mut self, unicode: &str) -> io::Result<()>; - fn stdout(&mut self) -> &mut StdoutLock<'a>; + fn stdout(&mut self) -> &mut StdoutLock<'lock>; } -impl<'a, 'b> CountedWrite<'b> for MaxLenWriter<'a, 'b> { +impl<'lock> CountedWrite<'lock> for MaxLenWriter<'_, 'lock> { fn write_ascii(&mut self, ascii: &[u8]) -> io::Result<()> { let n = ascii.len().min(self.max_len.saturating_sub(self.len)); if n > 0 { @@ -65,7 +65,7 @@ impl<'a, 'b> CountedWrite<'b> for MaxLenWriter<'a, 'b> { } #[inline] - fn stdout(&mut self) -> &mut StdoutLock<'b> { + fn stdout(&mut self) -> &mut StdoutLock<'lock> { self.stdout } } @@ -87,17 +87,17 @@ impl<'a> CountedWrite<'a> for StdoutLock<'a> { } } -pub struct CheckProgressVisualizer<'a, 'b> { - stdout: &'a mut StdoutLock<'b>, +pub struct CheckProgressVisualizer<'a, 'lock> { + stdout: &'a mut StdoutLock<'lock>, n_cols: usize, } -impl<'a, 'b> CheckProgressVisualizer<'a, 'b> { +impl<'a, 'lock> CheckProgressVisualizer<'a, 'lock> { const CHECKING_COLOR: Color = Color::Blue; const DONE_COLOR: Color = Color::Green; const PENDING_COLOR: Color = Color::Red; - pub fn build(stdout: &'a mut StdoutLock<'b>, term_width: u16) -> io::Result<Self> { + pub fn build(stdout: &'a mut StdoutLock<'lock>, term_width: u16) -> io::Result<Self> { clear_terminal(stdout)?; stdout.write_all("Checking all exercises…\n".as_bytes())?; |
