diff --git a/src/usage_parser.rs b/src/usage_parser.rs index 7af82210..7c6807c8 100644 --- a/src/usage_parser.rs +++ b/src/usage_parser.rs @@ -341,8 +341,7 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -356,8 +355,7 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(b.num_vals.is_none()); } @@ -371,8 +369,7 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -386,8 +383,7 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(d.num_vals.is_none()); } @@ -401,8 +397,7 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -416,8 +411,7 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -431,8 +425,7 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(b.num_vals.is_none()); } @@ -446,8 +439,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -461,8 +453,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -476,8 +467,7 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(d.num_vals.is_none()); } @@ -491,8 +481,7 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -506,8 +495,8 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -521,8 +510,7 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -536,8 +524,8 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -551,8 +539,7 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -566,8 +553,7 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -581,8 +567,8 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -596,8 +582,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -611,8 +596,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -626,8 +610,8 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -641,8 +625,7 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -656,8 +639,8 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -671,8 +654,7 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -686,8 +668,8 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -701,8 +683,7 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -716,8 +697,7 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(a.num_vals.is_none()); } @@ -731,8 +711,8 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -746,8 +726,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -761,8 +740,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -776,8 +754,8 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -791,8 +769,8 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(a.num_vals.is_none()); } @@ -806,8 +784,8 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -821,8 +799,7 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -836,8 +813,8 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -851,8 +828,8 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(a.num_vals.is_none()); } @@ -866,8 +843,8 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -881,8 +858,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -896,8 +872,8 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -911,8 +887,8 @@ mod test { assert!(!a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(a.num_vals.is_none()); } @@ -926,8 +902,8 @@ mod test { assert!(!b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -941,8 +917,7 @@ mod test { assert!(!c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -956,8 +931,8 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(d.num_vals.is_none()); } @@ -971,8 +946,8 @@ mod test { assert!(a.is_set(ArgSettings::Multiple)); assert!(a.is_set(ArgSettings::TakesValue)); assert!(!a.is_set(ArgSettings::Required)); - assert_eq!(a.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(a.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(a.num_vals.is_none()); } @@ -986,8 +961,8 @@ mod test { assert!(b.is_set(ArgSettings::Multiple)); assert!(b.is_set(ArgSettings::TakesValue)); assert!(!b.is_set(ArgSettings::Required)); - assert_eq!(b.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(b.val_names.unwrap().values().collect::>(), + [&"option"]); assert!(b.num_vals.is_none()); } @@ -1001,8 +976,7 @@ mod test { assert!(c.is_set(ArgSettings::Multiple)); assert!(c.is_set(ArgSettings::TakesValue)); assert!(c.is_set(ArgSettings::Required)); - assert_eq!(c.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["opt"]); + assert_eq!(c.val_names.unwrap().values().collect::>(), [&"opt"]); assert!(c.num_vals.is_none()); } @@ -1016,8 +990,7 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["option"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), [&"option"]); assert!(d.num_vals.is_none()); } @@ -1031,8 +1004,8 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["file", "mode"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"file", &"mode"]); assert_eq!(d.num_vals.unwrap(), 2); } @@ -1046,8 +1019,8 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["file", "mode"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"file", &"mode"]); assert_eq!(d.num_vals.unwrap(), 2); } @@ -1061,8 +1034,8 @@ mod test { assert!(d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["file", "mode"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"file", &"mode"]); assert_eq!(d.num_vals.unwrap(), 2); } @@ -1076,8 +1049,8 @@ mod test { assert!(!d.is_set(ArgSettings::Multiple)); assert!(d.is_set(ArgSettings::TakesValue)); assert!(!d.is_set(ArgSettings::Required)); - assert_eq!(d.val_names.unwrap().iter().map(|(_, &v)| v).collect::>(), - ["file", "mode"]); + assert_eq!(d.val_names.unwrap().values().collect::>(), + [&"file", &"mode"]); assert_eq!(d.num_vals.unwrap(), 2); }