From 99496706c5041affdc252649bfc74d50a2187271 Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 17 Oct 2024 14:44:48 +0200 Subject: [PATCH] Apply new Clippy lints --- src/cmd.rs | 2 +- src/term.rs | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cmd.rs b/src/cmd.rs index 4a93312a..30f988a6 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -125,7 +125,7 @@ pub struct CargoSubcommand<'out> { output: Option<&'out mut Vec>, } -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 e3bfd7bb..cb0a07ce 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 { + pub fn build(stdout: &'a mut StdoutLock<'lock>, term_width: u16) -> io::Result { clear_terminal(stdout)?; stdout.write_all("Checking all exercises…\n".as_bytes())?;