Skip to content

Commit 79f991d

Browse files
authored
Merge pull request #6898 from sylvestre/fix-clipp
Fix new clippy warnings
2 parents 75de5a0 + ffbc682 commit 79f991d

File tree

27 files changed

+107
-126
lines changed

27 files changed

+107
-126
lines changed

src/uu/csplit/src/csplit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ struct SplitWriter<'a> {
197197
dev_null: bool,
198198
}
199199

200-
impl<'a> Drop for SplitWriter<'a> {
200+
impl Drop for SplitWriter<'_> {
201201
fn drop(&mut self) {
202202
if self.options.elide_empty_files && self.size == 0 {
203203
let file_name = self.options.split_name.get(self.counter);
@@ -206,7 +206,7 @@ impl<'a> Drop for SplitWriter<'a> {
206206
}
207207
}
208208

209-
impl<'a> SplitWriter<'a> {
209+
impl SplitWriter<'_> {
210210
fn new(options: &CsplitOptions) -> SplitWriter {
211211
SplitWriter {
212212
options,

src/uu/cut/src/matcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'a> ExactMatcher<'a> {
2323
}
2424
}
2525

26-
impl<'a> Matcher for ExactMatcher<'a> {
26+
impl Matcher for ExactMatcher<'_> {
2727
fn next_match(&self, haystack: &[u8]) -> Option<(usize, usize)> {
2828
let mut pos = 0usize;
2929
loop {

src/uu/cut/src/searcher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<'a, 'b, M: Matcher> Searcher<'a, 'b, M> {
2727
// Iterate over field delimiters
2828
// Returns (first, last) positions of each sequence, where `haystack[first..last]`
2929
// corresponds to the delimiter.
30-
impl<'a, 'b, M: Matcher> Iterator for Searcher<'a, 'b, M> {
30+
impl<M: Matcher> Iterator for Searcher<'_, '_, M> {
3131
type Item = (usize, usize);
3232

3333
fn next(&mut self) -> Option<Self::Item> {

src/uu/date/src/date.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ enum Iso8601Format {
103103
Ns,
104104
}
105105

106-
impl<'a> From<&'a str> for Iso8601Format {
106+
impl From<&str> for Iso8601Format {
107107
fn from(s: &str) -> Self {
108108
match s {
109109
HOURS => Self::Hours,
@@ -123,7 +123,7 @@ enum Rfc3339Format {
123123
Ns,
124124
}
125125

126-
impl<'a> From<&'a str> for Rfc3339Format {
126+
impl From<&str> for Rfc3339Format {
127127
fn from(s: &str) -> Self {
128128
match s {
129129
DATE => Self::Date,

src/uu/dd/src/dd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ fn make_linux_iflags(iflags: &IFlags) -> Option<libc::c_int> {
424424
}
425425
}
426426

427-
impl<'a> Read for Input<'a> {
427+
impl Read for Input<'_> {
428428
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
429429
let mut base_idx = 0;
430430
let target_len = buf.len();
@@ -447,7 +447,7 @@ impl<'a> Read for Input<'a> {
447447
}
448448
}
449449

450-
impl<'a> Input<'a> {
450+
impl Input<'_> {
451451
/// Discard the system file cache for the given portion of the input.
452452
///
453453
/// `offset` and `len` specify a contiguous portion of the input.
@@ -928,7 +928,7 @@ enum BlockWriter<'a> {
928928
Unbuffered(Output<'a>),
929929
}
930930

931-
impl<'a> BlockWriter<'a> {
931+
impl BlockWriter<'_> {
932932
fn discard_cache(&self, offset: libc::off_t, len: libc::off_t) {
933933
match self {
934934
Self::Unbuffered(o) => o.discard_cache(offset, len),

src/uu/dd/src/numbers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
5-
/// Functions for formatting a number as a magnitude and a unit suffix.
5+
6+
//! Functions for formatting a number as a magnitude and a unit suffix.
67
78
/// The first ten powers of 1024.
89
const IEC_BASES: [u128; 10] = [

src/uu/df/src/df.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ fn is_best(previous: &[MountInfo], mi: &MountInfo) -> bool {
311311
///
312312
/// Finally, if there are duplicate entries, the one with the shorter
313313
/// path is kept.
314-
315314
fn filter_mount_list(vmi: Vec<MountInfo>, opt: &Options) -> Vec<MountInfo> {
316315
let mut result = vec![];
317316
for mi in vmi {
@@ -331,7 +330,6 @@ fn filter_mount_list(vmi: Vec<MountInfo>, opt: &Options) -> Vec<MountInfo> {
331330
///
332331
/// `opt` excludes certain filesystems from consideration and allows for the synchronization of filesystems before running; see
333332
/// [`Options`] for more information.
334-
335333
fn get_all_filesystems(opt: &Options) -> UResult<Vec<Filesystem>> {
336334
// Run a sync call before any operation if so instructed.
337335
if opt.sync {

src/uu/env/src/string_parser.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ impl<'a> StringParser<'a> {
114114
}
115115

116116
pub fn peek_chunk(&self) -> Option<Chunk<'a>> {
117-
return self
118-
.get_chunk_with_length_at(self.pointer)
117+
self.get_chunk_with_length_at(self.pointer)
119118
.ok()
120-
.map(|(chunk, _)| chunk);
119+
.map(|(chunk, _)| chunk)
121120
}
122121

123122
pub fn consume_chunk(&mut self) -> Result<Chunk<'a>, Error> {

src/uu/env/src/variable_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct VariableParser<'a, 'b> {
1111
pub parser: &'b mut StringParser<'a>,
1212
}
1313

14-
impl<'a, 'b> VariableParser<'a, 'b> {
14+
impl<'a> VariableParser<'a, '_> {
1515
fn get_current_char(&self) -> Option<char> {
1616
self.parser.peek().ok()
1717
}

src/uu/fmt/src/linebreak.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct BreakArgs<'a> {
2020
ostream: &'a mut BufWriter<Stdout>,
2121
}
2222

23-
impl<'a> BreakArgs<'a> {
23+
impl BreakArgs<'_> {
2424
fn compute_width(&self, winfo: &WordInfo, posn: usize, fresh: bool) -> usize {
2525
if fresh {
2626
0

0 commit comments

Comments
 (0)