Merge pull request #1738 from birkenfeld/patch-1

Handle proc-macro crates in cargo-fmt
This commit is contained in:
Nick Cameron 2017-06-22 11:09:40 +12:00 committed by GitHub
commit 63784cb75f

View 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,
};