mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 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 config_load_result = Config::load(&path);
|
||||||
let mut config = Config::load(&path)
|
let config_errored = config_load_result.is_err();
|
||||||
.map_err(|err| {
|
let mut config = config_load_result
|
||||||
warn!("{err:?}");
|
.map_err(|err| warn!("{err:?}"))
|
||||||
config_errored = true;
|
|
||||||
})
|
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let spawn_at_startup = mem::take(&mut config.spawn_at_startup);
|
let spawn_at_startup = mem::take(&mut config.spawn_at_startup);
|
||||||
|
|||||||
Reference in New Issue
Block a user