diff --git a/bin/core/imag-view/src/main.rs b/bin/core/imag-view/src/main.rs index 09f88f83..ec13e0fe 100644 --- a/bin/core/imag-view/src/main.rs +++ b/bin/core/imag-view/src/main.rs @@ -99,7 +99,7 @@ fn main() { .map_err_trace_exit_unwrap(1); let query = format!("view.viewers.{}", viewer); - match config.config().read(&query) { + match config.read(&query) { Err(e) => trace_error_exit(&e, 1), Ok(None) => { error!("Cannot find '{}' in config", query); diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs index 8d7da252..0b75574d 100644 --- a/bin/core/imag/src/main.rs +++ b/bin/core/imag/src/main.rs @@ -256,7 +256,6 @@ fn main() { fn fetch_aliases(rt: &Runtime) -> Result, String> { let cfg = try!(rt.config().ok_or_else(|| String::from("No configuration found"))); let value = cfg - .config() .read("imag.aliases") .map_err(|_| String::from("Reading from config failed")); diff --git a/bin/domain/imag-bookmark/src/main.rs b/bin/domain/imag-bookmark/src/main.rs index c4401dbf..7f2131ce 100644 --- a/bin/domain/imag-bookmark/src/main.rs +++ b/bin/domain/imag-bookmark/src/main.rs @@ -169,7 +169,7 @@ fn get_collection_name(rt: &Runtime, .and_then(|scmd| scmd.value_of(collection_argument_name).map(String::from)) .unwrap_or_else(|| { rt.config() - .map(|cfg| match cfg.config().read("bookmark.default_collection") { + .map(|cfg| match cfg.read("bookmark.default_collection") { Err(e) => trace_error_exit(&e, 1), Ok(Some(&Value::String(ref name))) => name.clone(), Ok(None) => { diff --git a/bin/domain/imag-diary/src/util.rs b/bin/domain/imag-diary/src/util.rs index a6ed9342..40811c60 100644 --- a/bin/domain/imag-diary/src/util.rs +++ b/bin/domain/imag-diary/src/util.rs @@ -53,7 +53,6 @@ pub fn get_diary_timed_config(rt: &Runtime, diary_name: &str) -> Result Ok(None), Some(cfg) => { let v = cfg - .config() .read(&format!("diary.diaries.{}.timed", diary_name)) .chain_err(|| DiaryErrorKind::IOError); diff --git a/lib/domain/libimagdiary/src/config.rs b/lib/domain/libimagdiary/src/config.rs index c2a6a980..e306e5d7 100644 --- a/lib/domain/libimagdiary/src/config.rs +++ b/lib/domain/libimagdiary/src/config.rs @@ -34,10 +34,8 @@ pub fn get_default_diary_name(rt: &Runtime) -> Option { } pub fn get_diary_config_section<'a>(rt: &'a Runtime) -> Option<&'a Value> { - rt.config() - .map(|config| config.config()) - .and_then(|config| match config.read(&String::from("diary")) { - Ok(x) => x, - Err(_) => None, - }) + rt.config().and_then(|config| match config.read(&String::from("diary")) { + Ok(x) => x, + Err(_) => None, + }) } diff --git a/lib/etc/libimaginteraction/src/readline.rs b/lib/etc/libimaginteraction/src/readline.rs index 7d498ce5..3f9a6399 100644 --- a/lib/etc/libimaginteraction/src/readline.rs +++ b/lib/etc/libimaginteraction/src/readline.rs @@ -34,9 +34,8 @@ pub struct Readline { impl Readline { pub fn new(rt: &Runtime) -> Result { - let cfg = try!(rt.config().ok_or(IEK::NoConfigError)); + let c = try!(rt.config().ok_or(IEK::NoConfigError)); - let c = cfg.config(); let histfile = try!(c.lookup("ui.cli.readline_history_file").ok_or(IEK::ConfigError)); let histsize = try!(c.lookup("ui.cli.readline_history_size").ok_or(IEK::ConfigError)); let histigndups = try!(c.lookup("ui.cli.readline_history_ignore_dups").ok_or(IEK::ConfigError)); diff --git a/lib/etc/libimagutil/src/testing.rs b/lib/etc/libimagutil/src/testing.rs index 183afb63..168a2650 100644 --- a/lib/etc/libimagutil/src/testing.rs +++ b/lib/etc/libimagutil/src/testing.rs @@ -51,7 +51,8 @@ macro_rules! make_mock_app { use libimagrt::spec::CliSpec; use libimagrt::runtime::Runtime; use libimagrt::error::RuntimeError; - use libimagrt::configuration::{Configuration, InternalConfiguration}; + use libimagrt::configuration::InternalConfiguration; + use toml::Value; #[derive(Clone)] struct MockLinkApp<'a> { @@ -89,9 +90,8 @@ macro_rules! make_mock_app { } #[allow(unused)] - pub fn generate_minimal_test_config() -> Option { ::toml::de::from_str("[store]\nimplicit-create=true") - .map(Configuration::with_value) - .ok() + pub fn generate_minimal_test_config() -> Option { + ::toml::de::from_str("[store]\nimplicit-create=true").ok() } #[allow(unused)]