mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
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:
committed by
Ivan Molodetskikh
parent
ea7add3563
commit
7a10f71ee5
+4
-6
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user