@@ -440,20 +440,18 @@ fn cut_fields<R: Read, W: Write>(
440440 }
441441}
442442
443- fn cut_files ( mut filenames : Vec < OsString > , mode : & Mode ) {
443+ fn cut_files < ' a , I > ( filenames : I , mode : & Mode )
444+ where
445+ I : IntoIterator < Item = & ' a OsString > ,
446+ {
444447 let mut stdin_read = false ;
445-
446- if filenames. is_empty ( ) {
447- filenames. push ( OsString :: from ( "-" ) ) ;
448- }
449-
450448 let mut out: Box < dyn Write > = if stdout ( ) . is_terminal ( ) {
451449 Box :: new ( stdout ( ) )
452450 } else {
453451 Box :: new ( BufWriter :: new ( stdout ( ) ) ) as Box < dyn Write >
454452 } ;
455453
456- for filename in & filenames {
454+ for filename in filenames {
457455 if filename == "-" {
458456 if stdin_read {
459457 continue ;
@@ -674,12 +672,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
674672 } ;
675673
676674 let mode = mode_parse. map_err ( |e| USimpleError :: new ( 1 , e) ) ?;
677-
678- let files = matches
679- . get_many :: < OsString > ( options:: FILE )
680- . unwrap_or_default ( )
681- . cloned ( )
682- . collect ( ) ;
675+ #[ allow( clippy:: unwrap_used, reason = "clap provides '-' by default" ) ]
676+ let files = matches. get_many :: < OsString > ( options:: FILE ) . unwrap ( ) ;
683677
684678 cut_files ( files, & mode) ;
685679
@@ -776,6 +770,7 @@ pub fn uu_app() -> Command {
776770 . hide ( true )
777771 . action ( ArgAction :: Append )
778772 . value_hint ( clap:: ValueHint :: FilePath )
773+ . default_value ( "-" )
779774 . value_parser ( clap:: value_parser!( OsString ) ) ,
780775 )
781776 . arg (
0 commit comments