@@ -61,36 +61,28 @@ 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 ( )
66
+ . filter ( |( _, help) | * help != HIDDEN )
71
67
. map ( |( option_name, _) | option_name. len ( ) )
72
68
. max ( )
73
69
. unwrap_or ( 0 ) ;
74
- let help_lines : Vec < String > = non_hidden_options
70
+ let z_flags = options
75
71
. 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
- )
72
+ . filter ( |( _, help) | * help != HIDDEN )
73
+ . map ( |( opt, help) | {
74
+ let opt = opt. replace ( "_" , "-" ) ;
75
+ format ! ( " {literal}-Z {opt:<max_length$}{reset} {help}" )
82
76
} )
83
- . collect ( ) ;
84
- let joined = help_lines. join ( "\n " ) ;
77
+ . join ( "\n " ) ;
85
78
drop_println ! (
86
79
config,
87
80
"\
88
81
{header}Available unstable (nightly-only) flags:{reset}
89
82
90
- {}
83
+ {z_flags }
91
84
92
85
Run with `{literal}cargo -Z{reset} {placeholder}[FLAG] [COMMAND]{reset}`" ,
93
- joined
94
86
) ;
95
87
if !config. nightly_features_allowed {
96
88
drop_println ! (
0 commit comments