@@ -364,7 +364,7 @@ impl Options {
364
364
. ok_or_else ( || Fail :: UnrecognizedOption ( format ! ( "{:?}" , i. as_ref( ) ) ) )
365
365
. map ( |s| s. to_owned ( ) )
366
366
} ) . collect :: < :: std:: result:: Result < Vec < _ > , _ > > ( ) ?;
367
- let mut args = args. into_iter ( ) . peekable ( ) ;
367
+ let mut args = args. into_iter ( ) ;
368
368
let mut arg_pos = 0 ;
369
369
while let Some ( cur) = args. next ( ) {
370
370
if !is_arg ( & cur) {
@@ -382,7 +382,6 @@ impl Options {
382
382
} else {
383
383
let mut names;
384
384
let mut i_arg = None ;
385
- let mut was_long = true ;
386
385
if cur. as_bytes ( ) [ 1 ] == b'-' || self . long_only {
387
386
let tail = if cur. as_bytes ( ) [ 1 ] == b'-' {
388
387
& cur[ 2 ..]
@@ -396,7 +395,6 @@ impl Options {
396
395
i_arg = Some ( rest. to_string ( ) ) ;
397
396
}
398
397
} else {
399
- was_long = false ;
400
398
names = Vec :: new ( ) ;
401
399
for ( j, ch) in cur. char_indices ( ) . skip ( 1 ) {
402
400
let opt = Short ( ch) ;
@@ -444,21 +442,16 @@ impl Options {
444
442
vals[ optid] . push ( ( arg_pos, Given ) ) ;
445
443
}
446
444
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.
453
451
if let Some ( i_arg) = i_arg. take ( ) {
454
452
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 ) ) ;
460
453
} else {
461
- vals[ optid] . push ( ( arg_pos, Val ( args . next ( ) . unwrap ( ) ) ) ) ;
454
+ vals[ optid] . push ( ( arg_pos, Given ) ) ;
462
455
}
463
456
}
464
457
Yes => {
0 commit comments