summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-07-09 21:43:58 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-07-09 21:43:58 +0200
commitfad981a40f7051e627460f62bf7f3409dc634f58 (patch)
tree9c4cf02508bd965d453022ff5a43ec590efaf879
parent297eeb1bd24a79ff29c55d5a591db05577b08cfd (diff)
downloadimag-fad981a40f7051e627460f62bf7f3409dc634f58.zip
imag-fad981a40f7051e627460f62bf7f3409dc634f58.tar.gz
Update toml-query: 0.2.0 -> 0.3.0
-rw-r--r--libimagdiary/Cargo.toml2
-rw-r--r--libimagdiary/src/config.rs7
2 files changed, 6 insertions, 3 deletions
diff --git a/libimagdiary/Cargo.toml b/libimagdiary/Cargo.toml
index 0f89195..751530f 100644
--- a/libimagdiary/Cargo.toml
+++ b/libimagdiary/Cargo.toml
@@ -18,7 +18,7 @@ chrono = "0.2"
log = "0.3"
semver = "0.5"
toml = "0.4.*"
-toml-query = "0.2.*"
+toml-query = "0.3.*"
regex = "0.1"
itertools = "0.5"
diff --git a/libimagdiary/src/config.rs b/libimagdiary/src/config.rs
index a341b24..c2a6a98 100644
--- a/libimagdiary/src/config.rs
+++ b/libimagdiary/src/config.rs
@@ -27,7 +27,7 @@ pub fn get_default_diary_name(rt: &Runtime) -> Option<String> {
get_diary_config_section(rt)
.and_then(|config| {
match config.read(&String::from("default_diary")) {
- Ok(&Value::String(ref s)) => Some(s.clone()),
+ Ok(Some(&Value::String(ref s))) => Some(s.clone()),
_ => None,
}
})
@@ -36,5 +36,8 @@ pub fn get_default_diary_name(rt: &Runtime) -> Option<String> {
pub fn get_diary_config_section<'a>(rt: &'a Runtime) -> Option<&'a Value> {
rt.config()
.map(|config| config.config())
- .and_then(|config| config.read(&String::from("diary")).ok())
+ .and_then(|config| match config.read(&String::from("diary")) {
+ Ok(x) => x,
+ Err(_) => None,
+ })
}