diff --git a/exercises/practice/doubly-linked-list/tests/doubly-linked-list.rs b/exercises/practice/doubly-linked-list/tests/doubly-linked-list.rs index 101ef6c21..c3985d23c 100644 --- a/exercises/practice/doubly-linked-list/tests/doubly-linked-list.rs +++ b/exercises/practice/doubly-linked-list/tests/doubly-linked-list.rs @@ -259,7 +259,7 @@ fn drop_no_double_frees() { use std::cell::Cell; struct DropCounter<'a>(&'a Cell); - impl<'a> Drop for DropCounter<'a> { + impl Drop for DropCounter<'_> { fn drop(&mut self) { let num = self.0.get(); self.0.set(num + 1); diff --git a/exercises/practice/grep/tests/grep.rs b/exercises/practice/grep/tests/grep.rs index e6358f42c..1154d2d69 100644 --- a/exercises/practice/grep/tests/grep.rs +++ b/exercises/practice/grep/tests/grep.rs @@ -483,7 +483,7 @@ impl<'a> Files<'a> { } } -impl<'a> Drop for Files<'a> { +impl Drop for Files<'_> { fn drop(&mut self) { for file_name in self.file_names { std::fs::remove_file(file_name) diff --git a/exercises/practice/luhn-from/src/lib.rs b/exercises/practice/luhn-from/src/lib.rs index f7c991220..169f7e666 100644 --- a/exercises/practice/luhn-from/src/lib.rs +++ b/exercises/practice/luhn-from/src/lib.rs @@ -8,11 +8,11 @@ impl Luhn { /// Here is the example of how the From trait could be implemented /// for the &str type. Naturally, you can implement this trait -/// by hand for the every other type presented in the test suite, +/// by hand for every other type presented in the test suite, /// but your solution will fail if a new type is presented. /// Perhaps there exists a better solution for this problem? -impl<'a> From<&'a str> for Luhn { - fn from(input: &'a str) -> Self { +impl From<&str> for Luhn { + fn from(input: &str) -> Self { todo!("From the given input '{input}' create a new Luhn struct."); } } diff --git a/exercises/practice/luhn-trait/.meta/example.rs b/exercises/practice/luhn-trait/.meta/example.rs index ed71406fd..d5ab8c444 100644 --- a/exercises/practice/luhn-trait/.meta/example.rs +++ b/exercises/practice/luhn-trait/.meta/example.rs @@ -20,7 +20,7 @@ impl Luhn for String { } } -impl<'a> Luhn for &'a str { +impl Luhn for &str { fn valid_luhn(&self) -> bool { String::from(*self).valid_luhn() } diff --git a/exercises/practice/luhn-trait/src/lib.rs b/exercises/practice/luhn-trait/src/lib.rs index 6b958fecf..ccf07bbf8 100644 --- a/exercises/practice/luhn-trait/src/lib.rs +++ b/exercises/practice/luhn-trait/src/lib.rs @@ -4,10 +4,10 @@ pub trait Luhn { /// Here is the example of how to implement custom Luhn trait /// for the &str type. Naturally, you can implement this trait -/// by hand for the every other type presented in the test suite, +/// by hand for every other type presented in the test suite, /// but your solution will fail if a new type is presented. /// Perhaps there exists a better solution for this problem? -impl<'a> Luhn for &'a str { +impl Luhn for &str { fn valid_luhn(&self) -> bool { todo!("Determine if '{self}' is a valid credit card number."); } diff --git a/exercises/practice/matching-brackets/.meta/example.rs b/exercises/practice/matching-brackets/.meta/example.rs index 2da590030..4a139dae9 100644 --- a/exercises/practice/matching-brackets/.meta/example.rs +++ b/exercises/practice/matching-brackets/.meta/example.rs @@ -9,7 +9,7 @@ struct Brackets { pairs: MatchingBrackets, } -impl<'a> From<&'a str> for Brackets { +impl From<&str> for Brackets { fn from(i: &str) -> Self { Brackets::new(i, None) } diff --git a/exercises/practice/poker/.meta/example.rs b/exercises/practice/poker/.meta/example.rs index 02b5ed78d..f563ae0a1 100644 --- a/exercises/practice/poker/.meta/example.rs +++ b/exercises/practice/poker/.meta/example.rs @@ -51,7 +51,7 @@ impl fmt::Display for Suit { } } -impl<'a> TryFrom<&'a str> for Suit { +impl TryFrom<&str> for Suit { type Error = &'static str; fn try_from(source: &str) -> Result { @@ -115,7 +115,7 @@ impl PartialOrd for Rank { } } -impl<'a> TryFrom<&'a str> for Rank { +impl TryFrom<&str> for Rank { type Error = &'static str; fn try_from(source: &str) -> Result { @@ -160,7 +160,7 @@ impl fmt::Display for Card { } } -impl<'a> TryFrom<&'a str> for Card { +impl TryFrom<&str> for Card { type Error = &'static str; fn try_from(source: &str) -> Result { @@ -262,7 +262,7 @@ struct Hand<'a> { hand_type: PokerHand, } -impl<'a> Hand<'a> { +impl Hand<'_> { fn cmp_high_card(&self, other: &Hand, card: usize) -> Ordering { let mut ordering = self.cards[card] .rank @@ -312,13 +312,13 @@ impl<'a> Hand<'a> { } } -impl<'a> fmt::Display for Hand<'a> { +impl fmt::Display for Hand<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.source) } } -impl<'a> PartialOrd for Hand<'a> { +impl PartialOrd for Hand<'_> { fn partial_cmp(&self, other: &Hand) -> Option { Some(self.hand_type.cmp(&other.hand_type).then_with(|| { use crate::PokerHand::*; diff --git a/exercises/practice/react/.meta/example.rs b/exercises/practice/react/.meta/example.rs index 199bb46d0..03dac050b 100644 --- a/exercises/practice/react/.meta/example.rs +++ b/exercises/practice/react/.meta/example.rs @@ -249,7 +249,7 @@ impl<'a, T: Copy + PartialEq> Reactor<'a, T> { } } -impl<'a, T: Copy + PartialEq> Default for Reactor<'a, T> { +impl Default for Reactor<'_, T> { fn default() -> Self { Self::new() } diff --git a/exercises/practice/rectangles/.meta/example.rs b/exercises/practice/rectangles/.meta/example.rs index ef18d07d7..38673622c 100644 --- a/exercises/practice/rectangles/.meta/example.rs +++ b/exercises/practice/rectangles/.meta/example.rs @@ -70,7 +70,7 @@ impl Area for RealArea { struct TransposedArea<'a>(&'a RealArea); // For vertical scanning -impl<'a> Area for TransposedArea<'a> { +impl Area for TransposedArea<'_> { #[allow(clippy::misnamed_getters)] fn width(&self) -> usize { self.0.height diff --git a/exercises/practice/xorcism/.meta/example.rs b/exercises/practice/xorcism/.meta/example.rs index ee5d6e0a0..6c2f7190b 100644 --- a/exercises/practice/xorcism/.meta/example.rs +++ b/exercises/practice/xorcism/.meta/example.rs @@ -110,7 +110,7 @@ where } } -impl<'a, W> Write for Writer<'a, W> +impl Write for Writer<'_, W> where W: Write, { @@ -149,7 +149,7 @@ where } } -impl<'a, R> Read for Reader<'a, R> +impl Read for Reader<'_, R> where R: Read, {