File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ fn main() {
6161} 
6262
6363macro_rules!  each_subcommand{ 
64-     ( $mac: ident)  => ( { 
64+     ( $mac: ident)  => { 
6565        $mac!( bench) ; 
6666        $mac!( build) ; 
6767        $mac!( clean) ; 
@@ -91,7 +91,14 @@ macro_rules! each_subcommand{
9191        $mac!( verify_project) ; 
9292        $mac!( version) ; 
9393        $mac!( yank) ; 
94-     } ) 
94+     } 
95+ } 
96+ 
97+ mod  subcommands { 
98+     macro_rules!  declare_mod { 
99+         ( $name: ident)  => (  pub  mod  $name;  ) 
100+     } 
101+     each_subcommand ! ( declare_mod) ; 
95102} 
96103
97104/** 
@@ -152,10 +159,9 @@ fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
152159
153160    macro_rules!  cmd{ 
154161        ( $name: ident)  => ( if  args[ 1 ]  == stringify!( $name) . replace( "_" ,  "-" )  { 
155-             mod  $name; 
156162            config. shell( ) . set_verbose( true ) ; 
157-             let  r = cargo:: call_main_without_stdin( $name:: execute,  config, 
158-                                                    $name:: USAGE , 
163+             let  r = cargo:: call_main_without_stdin( subcommands :: $name:: execute,  config, 
164+                                                    subcommands :: $name:: USAGE , 
159165                                                   & args, 
160166                                                   false ) ; 
161167            cargo:: process_executed( r,  & mut  config. shell( ) ) ; 
@@ -232,7 +238,7 @@ fn list_commands(config: &Config) -> BTreeSet<String> {
232238    } 
233239
234240    macro_rules!  add_cmd { 
235-         ( $cmd: ident)  => ( commands. insert( stringify!( $cmd) . replace( "_" ,  "-" ) ) ) 
241+         ( $cmd: ident)  => ( {   commands. insert( stringify!( $cmd) . replace( "_" ,  "-" ) ) ;   } ) 
236242    } 
237243    each_subcommand ! ( add_cmd) ; 
238244    commands
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments