Skip to content

Commit 45ad661

Browse files
authored
fix clippy warnings (#1998)
[no important files changed]
1 parent a95f205 commit 45ad661

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

exercises/practice/doubly-linked-list/tests/doubly-linked-list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn drop_no_double_frees() {
259259
use std::cell::Cell;
260260
struct DropCounter<'a>(&'a Cell<usize>);
261261

262-
impl<'a> Drop for DropCounter<'a> {
262+
impl Drop for DropCounter<'_> {
263263
fn drop(&mut self) {
264264
let num = self.0.get();
265265
self.0.set(num + 1);

exercises/practice/grep/tests/grep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ impl<'a> Files<'a> {
483483
}
484484
}
485485

486-
impl<'a> Drop for Files<'a> {
486+
impl Drop for Files<'_> {
487487
fn drop(&mut self) {
488488
for file_name in self.file_names {
489489
std::fs::remove_file(file_name)

exercises/practice/luhn-from/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ impl Luhn {
88

99
/// Here is the example of how the From trait could be implemented
1010
/// for the &str type. Naturally, you can implement this trait
11-
/// by hand for the every other type presented in the test suite,
11+
/// by hand for every other type presented in the test suite,
1212
/// but your solution will fail if a new type is presented.
1313
/// Perhaps there exists a better solution for this problem?
14-
impl<'a> From<&'a str> for Luhn {
15-
fn from(input: &'a str) -> Self {
14+
impl From<&str> for Luhn {
15+
fn from(input: &str) -> Self {
1616
todo!("From the given input '{input}' create a new Luhn struct.");
1717
}
1818
}

exercises/practice/luhn-trait/.meta/example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Luhn for String {
2020
}
2121
}
2222

23-
impl<'a> Luhn for &'a str {
23+
impl Luhn for &str {
2424
fn valid_luhn(&self) -> bool {
2525
String::from(*self).valid_luhn()
2626
}

exercises/practice/luhn-trait/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ pub trait Luhn {
44

55
/// Here is the example of how to implement custom Luhn trait
66
/// for the &str type. Naturally, you can implement this trait
7-
/// by hand for the every other type presented in the test suite,
7+
/// by hand for every other type presented in the test suite,
88
/// but your solution will fail if a new type is presented.
99
/// Perhaps there exists a better solution for this problem?
10-
impl<'a> Luhn for &'a str {
10+
impl Luhn for &str {
1111
fn valid_luhn(&self) -> bool {
1212
todo!("Determine if '{self}' is a valid credit card number.");
1313
}

exercises/practice/matching-brackets/.meta/example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct Brackets {
99
pairs: MatchingBrackets,
1010
}
1111

12-
impl<'a> From<&'a str> for Brackets {
12+
impl From<&str> for Brackets {
1313
fn from(i: &str) -> Self {
1414
Brackets::new(i, None)
1515
}

exercises/practice/poker/.meta/example.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl fmt::Display for Suit {
5151
}
5252
}
5353

54-
impl<'a> TryFrom<&'a str> for Suit {
54+
impl TryFrom<&str> for Suit {
5555
type Error = &'static str;
5656

5757
fn try_from(source: &str) -> Result<Self, Self::Error> {
@@ -115,7 +115,7 @@ impl PartialOrd for Rank {
115115
}
116116
}
117117

118-
impl<'a> TryFrom<&'a str> for Rank {
118+
impl TryFrom<&str> for Rank {
119119
type Error = &'static str;
120120

121121
fn try_from(source: &str) -> Result<Self, Self::Error> {
@@ -160,7 +160,7 @@ impl fmt::Display for Card {
160160
}
161161
}
162162

163-
impl<'a> TryFrom<&'a str> for Card {
163+
impl TryFrom<&str> for Card {
164164
type Error = &'static str;
165165

166166
fn try_from(source: &str) -> Result<Self, Self::Error> {
@@ -262,7 +262,7 @@ struct Hand<'a> {
262262
hand_type: PokerHand,
263263
}
264264

265-
impl<'a> Hand<'a> {
265+
impl Hand<'_> {
266266
fn cmp_high_card(&self, other: &Hand, card: usize) -> Ordering {
267267
let mut ordering = self.cards[card]
268268
.rank
@@ -312,13 +312,13 @@ impl<'a> Hand<'a> {
312312
}
313313
}
314314

315-
impl<'a> fmt::Display for Hand<'a> {
315+
impl fmt::Display for Hand<'_> {
316316
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
317317
write!(f, "{}", self.source)
318318
}
319319
}
320320

321-
impl<'a> PartialOrd for Hand<'a> {
321+
impl PartialOrd for Hand<'_> {
322322
fn partial_cmp(&self, other: &Hand) -> Option<Ordering> {
323323
Some(self.hand_type.cmp(&other.hand_type).then_with(|| {
324324
use crate::PokerHand::*;

exercises/practice/react/.meta/example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl<'a, T: Copy + PartialEq> Reactor<'a, T> {
249249
}
250250
}
251251

252-
impl<'a, T: Copy + PartialEq> Default for Reactor<'a, T> {
252+
impl<T: Copy + PartialEq> Default for Reactor<'_, T> {
253253
fn default() -> Self {
254254
Self::new()
255255
}

exercises/practice/rectangles/.meta/example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Area for RealArea {
7070
struct TransposedArea<'a>(&'a RealArea);
7171

7272
// For vertical scanning
73-
impl<'a> Area for TransposedArea<'a> {
73+
impl Area for TransposedArea<'_> {
7474
#[allow(clippy::misnamed_getters)]
7575
fn width(&self) -> usize {
7676
self.0.height

exercises/practice/xorcism/.meta/example.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ where
110110
}
111111
}
112112

113-
impl<'a, W> Write for Writer<'a, W>
113+
impl<W> Write for Writer<'_, W>
114114
where
115115
W: Write,
116116
{
@@ -149,7 +149,7 @@ where
149149
}
150150
}
151151

152-
impl<'a, R> Read for Reader<'a, R>
152+
impl<R> Read for Reader<'_, R>
153153
where
154154
R: Read,
155155
{

0 commit comments

Comments
 (0)