Skip to content

Commit

Permalink
Handle proc-macro crates in cargo-fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
birkenfeld committed Jun 21, 2017
1 parent a4af0ec commit b95666b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bin/cargo-fmt.rs
Expand Up @@ -148,14 +148,15 @@ enum TargetKind {
Test, // test file
Bench, // bench file
CustomBuild, // build script
ProcMacro, // a proc macro implementation
Other, // plugin,...
}

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,
}
}
Expand Down Expand Up @@ -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,
};

Expand Down

0 comments on commit b95666b

Please sign in to comment.