File tree Expand file tree Collapse file tree 2 files changed +5
-17
lines changed
Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ fn with_unit(x: u64, arg: &ArgMatches) -> u64 {
7373 "K" => x / bytesize:: KIB ,
7474 "m" => x / bytesize:: MB ,
7575 "M" => x / bytesize:: MIB ,
76- _ => x , // impossible
76+ _ => unreachable ! ( ) ,
7777 } ;
7878 }
7979 x / bytesize:: KIB
Original file line number Diff line number Diff line change @@ -41,23 +41,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
4141
4242 let delay = matches. get_one :: < u64 > ( "delay" ) ;
4343 let count = matches. get_one :: < u64 > ( "count" ) ;
44- let mut count = if let Some ( count) = count {
45- if * count == 0 {
46- Some ( 1 )
47- } else {
48- Some ( * count)
49- }
50- } else {
51- None
52- } ;
53- let delay = if let Some ( delay) = delay {
54- * delay
55- } else {
56- if count. is_none ( ) {
57- count = Some ( 1 ) ;
58- }
44+ let mut count = count. copied ( ) . map ( |c| if c == 0 { 1 } else { c } ) ;
45+ let delay = delay. copied ( ) . unwrap_or_else ( || {
46+ count. get_or_insert ( 1 ) ;
5947 1
60- } ;
48+ } ) ;
6149
6250 let pickers = get_pickers ( & matches) ;
6351 let mut proc_data = ProcData :: new ( ) ;
You can’t perform that action at this time.
0 commit comments