2102: Fix propagation r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
This commit is contained in:
bors[bot] 2020-08-24 06:22:27 +00:00 committed by GitHub
commit 7853903052
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -2139,6 +2139,8 @@ impl<'help> App<'help> {
// Make sure all the globally set flags apply to us as well
self.settings = self.settings | self.g_settings;
self._propagate(Propagation::Full);
self._derive_display_order();
self._create_help_and_version();
@ -2242,8 +2244,11 @@ impl<'help> App<'help> {
$sc.max_w = $_self.max_w;
}
{
// FIXME: This doesn't belong here at all.
for a in $_self.args.args.iter().filter(|a| a.global) {
$sc.args.push(a.clone());
if $sc.find(&a.id).is_none() {
$sc.args.push(a.clone());
}
}
}
}};

View file

@ -51,3 +51,13 @@ fn app_send_sync() {
fn foo<T: Send + Sync>(_: T) {}
foo(App::new("test"))
}
#[test]
fn issue_2090() {
let mut app = App::new("app")
.global_setting(AppSettings::DisableVersion)
.subcommand(App::new("sub"));
app._build();
assert!(app.subcommands[0].is_set(AppSettings::DisableVersion));
}