aboutsummaryrefslogtreecommitdiff
path: root/src/manager
diff options
context:
space:
mode:
authorHristo Venev <hristo@venev.name>2020-02-06 15:03:29 +0100
committerHristo Venev <hristo@venev.name>2020-02-06 15:03:29 +0100
commitaa3fa809befbda4c28cbc84730fbe3ef8fe23c22 (patch)
tree7373344156ea07c956a14a27865f309298c2195d /src/manager
parent193df1747da0e3a899269d53f165c21df0bab836 (diff)
Remove an unwrap.
Diffstat (limited to 'src/manager')
-rw-r--r--src/manager/mod.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/manager/mod.rs b/src/manager/mod.rs
index d4799a7..39e486c 100644
--- a/src/manager/mod.rs
+++ b/src/manager/mod.rs
@@ -81,14 +81,9 @@ impl Manager {
}
}
- fn current_update(&mut self, c: &model::Config) {
- let data = serde_json::to_vec(c).unwrap();
- match fileutil::update(&self.state_path, &data) {
- Ok(()) => {}
- Err(e) => {
- eprintln!("<3>Failed to persist interface state: {}", e);
- }
- }
+ fn current_update(&mut self, c: &model::Config) -> io::Result<()> {
+ let data = serde_json::to_vec(c)?;
+ fileutil::update(&self.state_path, &data)
}
fn add_source(&mut self, config: config::Source) -> io::Result<()> {
@@ -213,7 +208,9 @@ impl Manager {
eprintln!("applying anyway");
}
self.dev.apply_diff(&self.current, &config)?;
- self.current_update(&config);
+ if let Err(e) = self.current_update(&config) {
+ eprintln!("<3>Failed to persist interface state: {}", e);
+ }
self.current = config;
}