refactor(main): eliminate a mut from config load code in main

I think this makes for marginally better readability, since you don't
have to wonder whether config_errored is set anywhere else. It's also
slightly terser.
This commit is contained in:
James Sully
2025-05-09 16:58:25 +10:00
committed by Ivan Molodetskikh
parent ea7add3563
commit 7a10f71ee5
+4 -6
View File
@@ -161,12 +161,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
}
let mut config_errored = false;
let mut config = Config::load(&path)
.map_err(|err| {
warn!("{err:?}");
config_errored = true;
})
let config_load_result = Config::load(&path);
let config_errored = config_load_result.is_err();
let mut config = config_load_result
.map_err(|err| warn!("{err:?}"))
.unwrap_or_default();
let spawn_at_startup = mem::take(&mut config.spawn_at_startup);