File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ fn main() {
61
61
}
62
62
63
63
macro_rules! each_subcommand{
64
- ( $mac: ident) => ( {
64
+ ( $mac: ident) => {
65
65
$mac!( bench) ;
66
66
$mac!( build) ;
67
67
$mac!( clean) ;
@@ -91,7 +91,14 @@ macro_rules! each_subcommand{
91
91
$mac!( verify_project) ;
92
92
$mac!( version) ;
93
93
$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) ;
95
102
}
96
103
97
104
/**
@@ -152,10 +159,9 @@ fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
152
159
153
160
macro_rules! cmd{
154
161
( $name: ident) => ( if args[ 1 ] == stringify!( $name) . replace( "_" , "-" ) {
155
- mod $name;
156
162
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 ,
159
165
& args,
160
166
false ) ;
161
167
cargo:: process_executed( r, & mut config. shell( ) ) ;
@@ -232,7 +238,7 @@ fn list_commands(config: &Config) -> BTreeSet<String> {
232
238
}
233
239
234
240
macro_rules! add_cmd {
235
- ( $cmd: ident) => ( commands. insert( stringify!( $cmd) . replace( "_" , "-" ) ) )
241
+ ( $cmd: ident) => ( { commands. insert( stringify!( $cmd) . replace( "_" , "-" ) ) ; } )
236
242
}
237
243
each_subcommand ! ( add_cmd) ;
238
244
commands
You can’t perform that action at this time.
0 commit comments