Skip to content
Permalink
Browse files

Do not run if rustfmt.toml does not exist

distcheck (and generally publishing tarballs) will not package
rustfmt.toml and we for now still support running tidy etc in those
tarballs.
  • Loading branch information
Mark-Simulacrum committed Dec 22, 2019
1 parent dddd872 commit b9e4174d8cf03fdcd0f9f128422b1f565d6b6607
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/bootstrap/format.rs
@@ -37,8 +37,13 @@ pub fn format(build: &Build, check: bool) {
builder.add_defaults();
builder.select("rust");
let matcher = builder.build().unwrap();

let rustfmt_config = t!(std::fs::read_to_string(build.src.join("rustfmt.toml")));
let rustfmt_config = build.src.join("rustfmt.toml");
if !rustfmt_config.exists() {
eprintln!("Not running formatting checks; rustfmt.toml does not exist.");
eprintln!("This may happen in distributed tarballs.");
return;
}
let rustfmt_config = t!(std::fs::read_to_string(&rustfmt_config));
let rustfmt_config: RustfmtConfig = t!(toml::from_str(&rustfmt_config));
let mut ignore_fmt = ignore::overrides::OverrideBuilder::new(&build.src);
for ignore in rustfmt_config.ignore {

0 comments on commit b9e4174

Please sign in to comment.
You can’t perform that action at this time.