Skip to content

Commit d521a9a

Browse files
committed
Remove non-inline modules in blocks
1 parent a3d8dcf commit d521a9a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/bin/cargo.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn main() {
6161
}
6262

6363
macro_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

0 commit comments

Comments
 (0)