From d521a9a007c596a8fdbdfbac5a812f789c145ac5 Mon Sep 17 00:00:00 2001
From: Jeffrey Seyfried <jeffrey.seyfried@gmail.com>
Date: Fri, 12 Feb 2016 21:31:27 +0000
Subject: [PATCH] Remove non-inline modules in blocks

---
 src/bin/cargo.rs | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs
index 23941b50e39..1ad07cf3772 100644
--- a/src/bin/cargo.rs
+++ b/src/bin/cargo.rs
@@ -61,7 +61,7 @@ fn main() {
 }
 
 macro_rules! each_subcommand{
-    ($mac:ident) => ({
+    ($mac:ident) => {
         $mac!(bench);
         $mac!(build);
         $mac!(clean);
@@ -91,7 +91,14 @@ macro_rules! each_subcommand{
         $mac!(verify_project);
         $mac!(version);
         $mac!(yank);
-    })
+    }
+}
+
+mod subcommands {
+    macro_rules! declare_mod {
+        ($name:ident) => ( pub mod $name; )
+    }
+    each_subcommand!(declare_mod);
 }
 
 /**
@@ -152,10 +159,9 @@ fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
 
     macro_rules! cmd{
         ($name:ident) => (if args[1] == stringify!($name).replace("_", "-") {
-            mod $name;
             config.shell().set_verbose(true);
-            let r = cargo::call_main_without_stdin($name::execute, config,
-                                                   $name::USAGE,
+            let r = cargo::call_main_without_stdin(subcommands::$name::execute, config,
+                                                   subcommands::$name::USAGE,
                                                    &args,
                                                    false);
             cargo::process_executed(r, &mut config.shell());
@@ -232,7 +238,7 @@ fn list_commands(config: &Config) -> BTreeSet<String> {
     }
 
     macro_rules! add_cmd {
-        ($cmd:ident) => (commands.insert(stringify!($cmd).replace("_", "-")))
+        ($cmd:ident) => ({ commands.insert(stringify!($cmd).replace("_", "-")); })
     }
     each_subcommand!(add_cmd);
     commands