Skip to content

Commit 9c80f41

Browse files
authored
Merge pull request #10619 from xtqqczze/clippy/map_clone
clippy: fix map_clone lint
2 parents 3035619 + 241091d commit 9c80f41

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,11 @@ uu_checksum_common = { version = "0.6.0", path = "src/uu/checksum_common" }
419419
uutests = { version = "0.6.0", package = "uutests", path = "tests/uutests" }
420420

421421
[dependencies]
422-
clap.workspace = true
423422
clap_complete = { workspace = true, optional = true }
424423
clap_mangen = { workspace = true, optional = true }
424+
clap.workspace = true
425425
fluent-syntax = { workspace = true, optional = true }
426+
itertools.workspace = true
426427
phf.workspace = true
427428
selinux = { workspace = true, optional = true }
428429
textwrap.workspace = true

src/bin/coreutils.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use clap::Command;
77
use coreutils::validation;
8+
use itertools::Itertools as _;
89
use std::cmp;
910
use std::ffi::OsString;
1011
use std::io::{self, Write};
@@ -28,10 +29,7 @@ fn usage<T>(utils: &UtilityMap<T>, name: &str) {
2829
println!("Options:");
2930
println!(" --list lists all defined functions, one per row\n");
3031
println!("Currently defined functions:\n");
31-
#[allow(clippy::map_clone)]
32-
let mut utils: Vec<&str> = utils.keys().map(|&s| s).collect();
33-
utils.sort_unstable();
34-
let display_list = utils.join(", ");
32+
let display_list = utils.keys().copied().sorted_unstable().join(", ");
3533
let width = cmp::min(textwrap::termwidth(), 100) - 4 * 2; // (opinion/heuristic) max 100 chars wide with 4 character side indentions
3634
println!(
3735
"{}",

0 commit comments

Comments
 (0)