Skip to content

Commit 3156deb

Browse files
Prevent failure in case there is no config.toml file
1 parent 228a0ed commit 3156deb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/bootstrap/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ impl Config {
444444

445445
let toml = file
446446
.map(|file| {
447-
let contents = t!(fs::read_to_string(&file));
448-
match toml::from_str(&contents) {
447+
fs::read_to_string(&file).ok().map(|contents| match toml::from_str(&contents) {
449448
Ok(table) => table,
450449
Err(err) => {
451450
println!(
@@ -455,8 +454,9 @@ impl Config {
455454
);
456455
process::exit(2);
457456
}
458-
}
457+
})
459458
})
459+
.flatten()
460460
.unwrap_or_else(TomlConfig::default);
461461

462462
let build = toml.build.clone().unwrap_or_default();

0 commit comments

Comments
 (0)