Skip to content

Commit c32e730

Browse files
committed
all: remove collect_{lossy,ignore} calls where possible
1 parent 4442b35 commit c32e730

34 files changed

Lines changed: 4 additions & 64 deletions

File tree

src/uu/base32/src/base_common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ pub fn parse_base_cmd_args(
8787
usage: &str,
8888
) -> UResult<Config> {
8989
let command = base_app(about, usage);
90-
let arg_list = args.collect_lossy();
91-
Config::from(&command.try_get_matches_from(arg_list)?)
90+
Config::from(&command.try_get_matches_from(args)?)
9291
}
9392

9493
pub fn base_app(about: &'static str, usage: &str) -> Command {

src/uu/cat/src/cat.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ mod options {
174174

175175
#[uucore::main]
176176
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
177-
let args = args.collect_ignore();
178-
179177
let matches = uu_app().try_get_matches_from(args)?;
180178

181179
let number_mode = if matches.get_flag(options::NUMBER_NONBLANK) {

src/uu/chroot/src/chroot.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ mod options {
3333

3434
#[uucore::main]
3535
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
36-
let args = args.collect_lossy();
37-
3836
let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
3937

4038
let default_shell: &'static str = "/bin/sh";

src/uu/cksum/src/cksum.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ mod options {
221221

222222
#[uucore::main]
223223
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
224-
let args = args.collect_ignore();
225-
226224
let matches = uu_app().try_get_matches_from(args)?;
227225

228226
let algo_name: &str = match matches.get_one::<String>(options::ALGORITHM) {

src/uu/comm/src/comm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ fn open_file(name: &str, line_ending: LineEnding) -> io::Result<LineReader> {
145145

146146
#[uucore::main]
147147
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
148-
let args = args.collect_lossy();
149-
150148
let matches = uu_app().try_get_matches_from(args)?;
151149
let line_ending = LineEnding::from_zero_flag(matches.get_flag(options::ZERO_TERMINATED));
152150
let filename1 = matches.get_one::<String>(options::FILE_1).unwrap();

src/uu/csplit/src/csplit.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,6 @@ where
552552

553553
#[uucore::main]
554554
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
555-
let args = args.collect_ignore();
556-
557555
let matches = uu_app().try_get_matches_from(args)?;
558556

559557
// get the file to split

src/uu/dd/src/dd.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,6 @@ fn is_fifo(filename: &str) -> bool {
12671267

12681268
#[uucore::main]
12691269
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
1270-
let args = args.collect_ignore();
1271-
12721270
let matches = uu_app().try_get_matches_from(args)?;
12731271

12741272
let settings: Settings = Parser::new().parse(

src/uu/dircolors/src/dircolors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ fn generate_ls_colors(fmt: &OutputFmt, sep: &str) -> String {
129129

130130
#[uucore::main]
131131
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
132-
let args = args.collect_ignore();
133-
134132
let matches = uu_app().try_get_matches_from(args)?;
135133

136134
let files = matches

src/uu/dirname/src/dirname.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ mod options {
2121

2222
#[uucore::main]
2323
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
24-
let args = args.collect_lossy();
25-
2624
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?;
2725

2826
let line_ending = LineEnding::from_zero_flag(matches.get_flag(options::ZERO));

src/uu/du/src/du.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,6 @@ pub fn div_ceil(a: u64, b: u64) -> u64 {
590590
#[uucore::main]
591591
#[allow(clippy::cognitive_complexity)]
592592
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
593-
let args = args.collect_ignore();
594-
595593
let matches = uu_app().try_get_matches_from(args)?;
596594

597595
let summarize = matches.get_flag(options::SUMMARIZE);

0 commit comments

Comments
 (0)