From 46774d765b24033379419bddbf41643ff5159a5d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 12 Jan 2018 16:31:41 +0100 Subject: [PATCH] libimagdiary: Replace read with typed read --- lib/domain/libimagdiary/src/config.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/domain/libimagdiary/src/config.rs b/lib/domain/libimagdiary/src/config.rs index e306e5d7..8686c013 100644 --- a/lib/domain/libimagdiary/src/config.rs +++ b/lib/domain/libimagdiary/src/config.rs @@ -22,19 +22,20 @@ use toml::Value; use libimagrt::runtime::Runtime; use toml_query::read::TomlValueReadExt; +use toml_query::read::TomlValueReadTypeExt; pub fn get_default_diary_name(rt: &Runtime) -> Option { get_diary_config_section(rt) .and_then(|config| { - match config.read(&String::from("default_diary")) { - Ok(Some(&Value::String(ref s))) => Some(s.clone()), + match config.read_string("default_diary") { + Ok(Some(ref s)) => Some(s.clone()), _ => None, } }) } pub fn get_diary_config_section<'a>(rt: &'a Runtime) -> Option<&'a Value> { - rt.config().and_then(|config| match config.read(&String::from("diary")) { + rt.config().and_then(|config| match config.read("diary") { Ok(x) => x, Err(_) => None, })