From f0e8e89c15dc2ba9037edc0adb31159d9f7439c6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 12 Jan 2018 16:30:09 +0100 Subject: [PATCH] imag-contact: Replace read with typed read --- bin/domain/imag-contact/src/main.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/bin/domain/imag-contact/src/main.rs b/bin/domain/imag-contact/src/main.rs index 412ae256..fe8cddc5 100644 --- a/bin/domain/imag-contact/src/main.rs +++ b/bin/domain/imag-contact/src/main.rs @@ -56,8 +56,7 @@ use std::path::PathBuf; use handlebars::Handlebars; use clap::ArgMatches; use vobject::vcard::Vcard; -use toml_query::read::TomlValueReadExt; -use toml::Value; +use toml_query::read::TomlValueReadTypeExt; use walkdir::WalkDir; use libimagrt::runtime::Runtime; @@ -219,18 +218,11 @@ fn get_contact_print_format(config_value_path: &'static str, rt: &Runtime, scmd: .unwrap_or_else(|| { rt.config() .ok_or_else(|| CE::from("No configuration file".to_owned())) - .map_err_trace_exit(1) - .unwrap() - .read(config_value_path) - .map_err_trace_exit(1) - .unwrap() + .map_err_trace_exit_unwrap(1) + .read_string(config_value_path) + .map_err_trace_exit_unwrap(1) .ok_or_else(|| CE::from("Configuration 'contact.list_format' does not exist".to_owned())) - .and_then(|value| match *value { - Value::String(ref s) => Ok(s.clone()), - _ => Err(CE::from("Type error: Expected String at 'contact.list_format'. Have non-String".to_owned())) - }) - .map_err_trace_exit(1) - .unwrap() + .map_err_trace_exit_unwrap(1) }); let mut hb = Handlebars::new();