From 5f5ce54edb90005fedb072356cd5053c9ac5deea Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 11 May 2019 13:37:14 +0200 Subject: [PATCH] Rewrite to use derive macro Signed-off-by: Matthias Beyer --- lib/core/libimagrt/src/lib.rs | 4 ++-- lib/core/libimagrt/src/logger.rs | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/core/libimagrt/src/lib.rs b/lib/core/libimagrt/src/lib.rs index 4247ff6c..ebe8f4fc 100644 --- a/lib/core/libimagrt/src/lib.rs +++ b/lib/core/libimagrt/src/lib.rs @@ -37,17 +37,17 @@ while_true, )] -#[macro_use] extern crate log; +extern crate log; extern crate itertools; extern crate ansi_term; extern crate handlebars; extern crate serde; #[macro_use] extern crate serde_derive; #[macro_use] extern crate failure; +#[macro_use] extern crate toml_query; extern crate clap; extern crate toml; -extern crate toml_query; extern crate atty; extern crate libimagstore; diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs index e7c03315..ebb9ec49 100644 --- a/lib/core/libimagrt/src/logger.rs +++ b/lib/core/libimagrt/src/logger.rs @@ -349,7 +349,6 @@ mod log_lvl_aggregate { fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Value>) -> Result> { - use toml_query::read::Partial; use std::convert::TryInto; // @@ -369,14 +368,10 @@ fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Value>) pub enabled: bool, } - #[derive(Serialize, Deserialize, Debug)] + #[derive(Partial, Serialize, Deserialize, Debug)] + #[location = "imag.logging.modules"] struct LoggingModuleConfigMap(BTreeMap); - impl<'a> Partial<'a> for LoggingModuleConfigMap { - const LOCATION: &'static str = "imag.logging.modules"; - type Output = Self; - } - impl TryInto> for LoggingModuleConfigMap { type Error = Error;