From 3156deb03cf1215ca7037cf7dca0fe67b1bcf00a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 23 Jun 2020 13:14:49 +0200 Subject: [PATCH] Prevent failure in case there is no config.toml file --- src/bootstrap/config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 771f952abc013..6dc66ec3403ab 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -444,8 +444,7 @@ impl Config { let toml = file .map(|file| { - let contents = t!(fs::read_to_string(&file)); - match toml::from_str(&contents) { + fs::read_to_string(&file).ok().map(|contents| match toml::from_str(&contents) { Ok(table) => table, Err(err) => { println!( @@ -455,8 +454,9 @@ impl Config { ); process::exit(2); } - } + }) }) + .flatten() .unwrap_or_else(TomlConfig::default); let build = toml.build.clone().unwrap_or_default();