use clap::Parser; #[test] fn test_safely_nest_parser() { #[derive(Parser, Debug, PartialEq)] struct Opt { #[command(flatten)] foo: Foo, } #[derive(Parser, Debug, PartialEq)] struct Foo { #[arg(long)] foo: bool, } assert_eq!( Opt { foo: Foo { foo: true } }, Opt::try_parse_from(&["test", "--foo"]).unwrap() ); }