Skip to content

Commit feca192

Browse files
committed
chore: a few minor lints
I ran this locally, using current main version of clippy: ```bash cargo dev lint path/to/coreutils -- --workspace --all-features ```
1 parent 398e4ba commit feca192

4 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/uu/cp/src/cp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ impl Options {
11131113
});
11141114
}
11151115
}
1116-
overriding_order.sort_by(|a, b| a.0.cmp(&b.0));
1116+
overriding_order.sort_by_key(|a| a.0);
11171117

11181118
let mut attributes = Attributes::NONE;
11191119

src/uu/fmt/src/parasplit.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,9 @@ impl Iterator for ParagraphStream<'_> {
421421

422422
let mut in_mail = false;
423423
let mut second_done = false; // for when we use crown or tagged mode
424-
loop {
424+
while let Some(Line::FormatLine(fl)) = self.lines.peek() {
425425
// peek ahead
426426
// need to explicitly force fl out of scope before we can call self.lines.next()
427-
let Some(Line::FormatLine(fl)) = self.lines.peek() else {
428-
break;
429-
};
430-
431427
if p_lines.is_empty() {
432428
// first time through the loop, get things set up
433429
// detect mail header

src/uu/ls/src/ls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3579,8 +3579,7 @@ fn get_security_context<'a>(
35793579
};
35803580

35813581
return uucore::smack::get_smack_label_for_path(&target_path)
3582-
.map(Cow::Owned)
3583-
.unwrap_or(Cow::Borrowed(SUBSTITUTE_STRING));
3582+
.map_or(Cow::Borrowed(SUBSTITUTE_STRING), Cow::Owned);
35843583
}
35853584

35863585
Cow::Borrowed(SUBSTITUTE_STRING)

src/uucore/src/lib/features/checksum/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,7 @@ pub fn sanitize_sha2_sha3_length_str(algo_kind: AlgoKind, length: &str) -> UResu
543543
pub fn unescape_filename(filename: &[u8]) -> (Vec<u8>, &'static str) {
544544
let mut unescaped = Vec::with_capacity(filename.len());
545545
let mut byte_iter = filename.iter().peekable();
546-
loop {
547-
let Some(byte) = byte_iter.next() else {
548-
break;
549-
};
546+
while let Some(byte) = byte_iter.next() {
550547
if *byte == b'\\' {
551548
match byte_iter.next() {
552549
Some(b'\\') => unescaped.push(b'\\'),

0 commit comments

Comments
 (0)