@@ -14,16 +14,6 @@ use super::list_commands;
1414use crate :: command_prelude:: * ;
1515use cargo:: core:: features:: HIDDEN ;
1616
17- lazy_static:: lazy_static! {
18- // Maps from commonly known external commands (not builtin to cargo) to their
19- // description, for the help page. Reserved for external subcommands that are
20- // core within the rust ecosystem (esp ones that might become internal in the future).
21- static ref KNOWN_EXTERNAL_COMMAND_DESCRIPTIONS : HashMap <& ' static str , & ' static str > = HashMap :: from( [
22- ( "clippy" , "Checks a package to catch common mistakes and improve your Rust code." ) ,
23- ( "fmt" , "Formats all bin and lib files of the current crate using rustfmt." ) ,
24- ] ) ;
25- }
26-
2717pub fn main ( config : & mut LazyConfig ) -> CliResult {
2818 let args = cli ( ) . try_get_matches ( ) ?;
2919
@@ -128,15 +118,28 @@ Run with 'cargo -Z [FLAG] [COMMAND]'",
128118 }
129119
130120 if expanded_args. flag ( "list" ) {
121+ // Maps from commonly known external commands (not builtin to cargo)
122+ // to their description, for the help page. Reserved for external
123+ // subcommands that are core within the rust ecosystem (esp ones that
124+ // might become internal in the future).
125+ let known_external_command_descriptions = HashMap :: from ( [
126+ (
127+ "clippy" ,
128+ "Checks a package to catch common mistakes and improve your Rust code." ,
129+ ) ,
130+ (
131+ "fmt" ,
132+ "Formats all bin and lib files of the current crate using rustfmt." ,
133+ ) ,
134+ ] ) ;
131135 drop_println ! ( config, "Installed Commands:" ) ;
132136 for ( name, command) in list_commands ( config) {
133- let known_external_desc = KNOWN_EXTERNAL_COMMAND_DESCRIPTIONS . get ( name. as_str ( ) ) ;
137+ let known_external_desc = known_external_command_descriptions . get ( name. as_str ( ) ) ;
134138 match command {
135139 CommandInfo :: BuiltIn { about } => {
136140 assert ! (
137141 known_external_desc. is_none( ) ,
138- "KNOWN_EXTERNAL_COMMANDS shouldn't contain builtin \" {}\" " ,
139- name
142+ "known_external_commands shouldn't contain builtin `{name}`" ,
140143 ) ;
141144 let summary = about. unwrap_or_default ( ) ;
142145 let summary = summary. lines ( ) . next ( ) . unwrap_or ( & summary) ; // display only the first line
0 commit comments