Fixed help benchmark

This commit is contained in:
Alena Yuryeva 2018-09-01 20:42:31 +03:00
parent 99bd101ea7
commit 1216cddb63
2 changed files with 10 additions and 5 deletions

View file

@ -22,15 +22,15 @@ fn app_example1<'b, 'c>() -> App<'b, 'c> {
.version("1.0")
.author("Kevin K. <kbknapp@gmail.com>")
.about("Does awesome things")
.args_from_usage(
"-c, --config=[FILE] 'Sets a custom config file'
<output> 'Sets an optional output file'
-d... 'Turn debugging information on'",
.arg(
"-c, --config=[FILE] 'Sets a custom config file'"
)
.arg("<output> 'Sets an optional output file'")
.arg("-d... 'Turn debugging information on'")
.subcommand(
SubCommand::with_name("test")
.about("does testing things")
.arg_from_usage("-l, --list 'lists test values'"),
.arg("-l, --list 'lists test values'"),
)
}

View file

@ -1437,6 +1437,7 @@ impl<'a, 'b> App<'a, 'b> {
true
});
let mut pos_counter = 1;
for a in self.args.values_mut() {
// Fill in the groups
if let Some(ref grps) = a.groups {
@ -1462,6 +1463,10 @@ impl<'a, 'b> App<'a, 'b> {
self.settings.set(AppSettings::ContainsLast);
}
a._build();
if a.short.is_none() && a.long.is_none() && a.index.is_none() {
a.index = Some(pos_counter);
pos_counter+=1;
}
}
debug_assert!(self._app_debug_asserts());