From b9e4174d8cf03fdcd0f9f128422b1f565d6b6607 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 22 Dec 2019 07:44:09 -0500 Subject: 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. --- src/bootstrap/format.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index e253e525526..c8ae2f4e688 100644 --- a/src/bootstrap/format.rs +++ b/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 { -- cgit 1.4.1-3-g733a5