@@ -61,36 +61,27 @@ pub fn main(config: &mut LazyConfig) -> CliResult {
61
61
let reset = anstyle:: Reset . render ( ) ;
62
62
63
63
let options = CliUnstable :: help ( ) ;
64
- let non_hidden_options: Vec < ( String , String ) > = options
65
- . iter ( )
66
- . filter ( |( _, help_message) | * help_message != HIDDEN )
67
- . map ( |( name, help) | ( name. to_string ( ) , help. to_string ( ) ) )
68
- . collect ( ) ;
69
- let longest_option = non_hidden_options
64
+ let max_length = options
70
65
. iter ( )
71
66
. map ( |( option_name, _) | option_name. len ( ) )
72
67
. max ( )
73
- . unwrap_or ( 0 ) ;
74
- let help_lines : Vec < String > = non_hidden_options
68
+ . unwrap ( ) ;
69
+ let z_flags = options
75
70
. iter ( )
76
- . map ( |( option_name, option_help_message) | {
77
- let option_name_kebab_case = option_name. replace ( "_" , "-" ) ;
78
- format ! (
79
- " {literal}-Z {:<longest_option$}{reset} {}" ,
80
- option_name_kebab_case, option_help_message
81
- )
71
+ . filter ( |( _, help) | * help != HIDDEN )
72
+ . map ( |( opt, help) | {
73
+ let opt = opt. replace ( "_" , "-" ) ;
74
+ format ! ( " {literal}-Z {opt:<max_length$}{reset} {help}" )
82
75
} )
83
- . collect ( ) ;
84
- let joined = help_lines. join ( "\n " ) ;
76
+ . join ( "\n " ) ;
85
77
drop_println ! (
86
78
config,
87
79
"\
88
80
{header}Available unstable (nightly-only) flags:{reset}
89
81
90
- {}
82
+ {z_flags }
91
83
92
84
Run with `{literal}cargo -Z{reset} {placeholder}[FLAG] [COMMAND]{reset}`" ,
93
- joined
94
85
) ;
95
86
if !config. nightly_features_allowed {
96
87
drop_println ! (
0 commit comments