@@ -364,7 +364,7 @@ impl Options {
364364 . ok_or_else ( || Fail :: UnrecognizedOption ( format ! ( "{:?}" , i. as_ref( ) ) ) )
365365 . map ( |s| s. to_owned ( ) )
366366 } ) . collect :: < :: std:: result:: Result < Vec < _ > , _ > > ( ) ?;
367- let mut args = args. into_iter ( ) . peekable ( ) ;
367+ let mut args = args. into_iter ( ) ;
368368 let mut arg_pos = 0 ;
369369 while let Some ( cur) = args. next ( ) {
370370 if !is_arg ( & cur) {
@@ -382,7 +382,6 @@ impl Options {
382382 } else {
383383 let mut names;
384384 let mut i_arg = None ;
385- let mut was_long = true ;
386385 if cur. as_bytes ( ) [ 1 ] == b'-' || self . long_only {
387386 let tail = if cur. as_bytes ( ) [ 1 ] == b'-' {
388387 & cur[ 2 ..]
@@ -396,7 +395,6 @@ impl Options {
396395 i_arg = Some ( rest. to_string ( ) ) ;
397396 }
398397 } else {
399- was_long = false ;
400398 names = Vec :: new ( ) ;
401399 for ( j, ch) in cur. char_indices ( ) . skip ( 1 ) {
402400 let opt = Short ( ch) ;
@@ -444,21 +442,16 @@ impl Options {
444442 vals[ optid] . push ( ( arg_pos, Given ) ) ;
445443 }
446444 Maybe => {
447- // Note that here we do not handle `--arg value`.
448- // This matches GNU getopt behavior; but also
449- // makes sense, because if this were accepted,
450- // then users could only write a "Maybe" long
451- // option at the end of the arguments when
452- // FloatingFrees is in use.
445+ // Note that here we do not handle `--arg value` or
446+ // `-a value`. This matches GNU getopt behavior; but
447+ // also makes sense, because if this were accepted,
448+ // then users could only write a "Maybe" option at
449+ // the end of the arguments when FloatingFrees is in
450+ // use.
453451 if let Some ( i_arg) = i_arg. take ( ) {
454452 vals[ optid] . push ( ( arg_pos, Val ( i_arg) ) ) ;
455- } else if was_long
456- || name_pos < names. len ( )
457- || args. peek ( ) . map_or ( true , |n| is_arg ( & n) )
458- {
459- vals[ optid] . push ( ( arg_pos, Given ) ) ;
460453 } else {
461- vals[ optid] . push ( ( arg_pos, Val ( args . next ( ) . unwrap ( ) ) ) ) ;
454+ vals[ optid] . push ( ( arg_pos, Given ) ) ;
462455 }
463456 }
464457 Yes => {
0 commit comments