]> git.lizzy.rs Git - rust.git/commitdiff
Handle proc-macro crates in cargo-fmt
authorGeorg Brandl <georg@python.org>
Wed, 21 Jun 2017 05:32:23 +0000 (07:32 +0200)
committerGitHub <noreply@github.com>
Wed, 21 Jun 2017 05:32:23 +0000 (07:32 +0200)
src/bin/cargo-fmt.rs

index c8202eb7e41bd09a77ec05c6b3f2ca50b2e95025..b4a1b3d51722176891c1c5471e5249f7e8dd38f8 100644 (file)
@@ -148,6 +148,7 @@ enum TargetKind {
     Test, // test file
     Bench, // bench file
     CustomBuild, // build script
+    ProcMacro, // a proc macro implementation
     Other, // plugin,...
 }
 
@@ -155,7 +156,7 @@ impl TargetKind {
     fn should_format(&self) -> bool {
         match *self {
             TargetKind::Lib | TargetKind::Bin | TargetKind::Example | TargetKind::Test |
-            TargetKind::Bench | TargetKind::CustomBuild => true,
+            TargetKind::Bench | TargetKind::CustomBuild | TargetKind::ProcMacro => true,
             _ => false,
         }
     }
@@ -282,6 +283,7 @@ fn target_from_json(jtarget: &Value) -> Target {
         "example" => TargetKind::Example,
         "bench" => TargetKind::Bench,
         "custom-build" => TargetKind::CustomBuild,
+        "proc-macro" => TargetKind::ProcMacro,
         _ => TargetKind::Other,
     };