From: Georg Brandl Date: Wed, 21 Jun 2017 05:32:23 +0000 (+0200) Subject: Handle proc-macro crates in cargo-fmt X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=b95666b20cf0b12c4396ec56e6bc04fc3555f268;p=rust.git Handle proc-macro crates in cargo-fmt --- diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs index c8202eb7e41..b4a1b3d5172 100644 --- a/src/bin/cargo-fmt.rs +++ b/src/bin/cargo-fmt.rs @@ -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, };