Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b9e4174

Browse files
committedDec 22, 2019
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.
1 parent dddd872 commit b9e4174

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/bootstrap/format.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ pub fn format(build: &Build, check: bool) {
3737
builder.add_defaults();
3838
builder.select("rust");
3939
let matcher = builder.build().unwrap();
40-
41-
let rustfmt_config = t!(std::fs::read_to_string(build.src.join("rustfmt.toml")));
40+
let rustfmt_config = build.src.join("rustfmt.toml");
41+
if !rustfmt_config.exists() {
42+
eprintln!("Not running formatting checks; rustfmt.toml does not exist.");
43+
eprintln!("This may happen in distributed tarballs.");
44+
return;
45+
}
46+
let rustfmt_config = t!(std::fs::read_to_string(&rustfmt_config));
4247
let rustfmt_config: RustfmtConfig = t!(toml::from_str(&rustfmt_config));
4348
let mut ignore_fmt = ignore::overrides::OverrideBuilder::new(&build.src);
4449
for ignore in rustfmt_config.ignore {

0 commit comments

Comments
 (0)
Failed to load comments.