mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 23:10:30 +00:00
Apply new Clippy lints
This commit is contained in:
parent
f146553dea
commit
99496706c5
2 changed files with 13 additions and 13 deletions
|
@ -125,7 +125,7 @@ pub struct CargoSubcommand<'out> {
|
||||||
output: Option<&'out mut Vec<u8>>,
|
output: Option<&'out mut Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'out> CargoSubcommand<'out> {
|
impl CargoSubcommand<'_> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn args<'arg, I>(&mut self, args: I) -> &mut Self
|
pub fn args<'arg, I>(&mut self, args: I) -> &mut Self
|
||||||
where
|
where
|
||||||
|
|
24
src/term.rs
24
src/term.rs
|
@ -11,15 +11,15 @@ use std::{
|
||||||
|
|
||||||
use crate::app_state::CheckProgress;
|
use crate::app_state::CheckProgress;
|
||||||
|
|
||||||
pub struct MaxLenWriter<'a, 'b> {
|
pub struct MaxLenWriter<'a, 'lock> {
|
||||||
pub stdout: &'a mut StdoutLock<'b>,
|
pub stdout: &'a mut StdoutLock<'lock>,
|
||||||
len: usize,
|
len: usize,
|
||||||
max_len: usize,
|
max_len: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> MaxLenWriter<'a, 'b> {
|
impl<'a, 'lock> MaxLenWriter<'a, 'lock> {
|
||||||
#[inline]
|
#[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 {
|
Self {
|
||||||
stdout,
|
stdout,
|
||||||
len: 0,
|
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_ascii(&mut self, ascii: &[u8]) -> io::Result<()>;
|
||||||
fn write_str(&mut self, unicode: &str) -> 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<()> {
|
fn write_ascii(&mut self, ascii: &[u8]) -> io::Result<()> {
|
||||||
let n = ascii.len().min(self.max_len.saturating_sub(self.len));
|
let n = ascii.len().min(self.max_len.saturating_sub(self.len));
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
|
@ -65,7 +65,7 @@ impl<'a, 'b> CountedWrite<'b> for MaxLenWriter<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn stdout(&mut self) -> &mut StdoutLock<'b> {
|
fn stdout(&mut self) -> &mut StdoutLock<'lock> {
|
||||||
self.stdout
|
self.stdout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,17 +87,17 @@ impl<'a> CountedWrite<'a> for StdoutLock<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CheckProgressVisualizer<'a, 'b> {
|
pub struct CheckProgressVisualizer<'a, 'lock> {
|
||||||
stdout: &'a mut StdoutLock<'b>,
|
stdout: &'a mut StdoutLock<'lock>,
|
||||||
n_cols: usize,
|
n_cols: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> CheckProgressVisualizer<'a, 'b> {
|
impl<'a, 'lock> CheckProgressVisualizer<'a, 'lock> {
|
||||||
const CHECKING_COLOR: Color = Color::Blue;
|
const CHECKING_COLOR: Color = Color::Blue;
|
||||||
const DONE_COLOR: Color = Color::Green;
|
const DONE_COLOR: Color = Color::Green;
|
||||||
const PENDING_COLOR: Color = Color::Red;
|
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)?;
|
clear_terminal(stdout)?;
|
||||||
stdout.write_all("Checking all exercises…\n".as_bytes())?;
|
stdout.write_all("Checking all exercises…\n".as_bytes())?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue