From c7ac440c92d4ffc2c129c63cade551a8608523e3 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 10:45:23 +0200 Subject: [PATCH] [Auto] lib/core/rt: Fix Clippy warnings Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- lib/core/libimagrt/src/configuration.rs | 4 ++-- lib/core/libimagrt/src/logger.rs | 22 +++++++++++----------- lib/core/libimagrt/src/runtime.rs | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/core/libimagrt/src/configuration.rs b/lib/core/libimagrt/src/configuration.rs index c6a45477..62233be9 100644 --- a/lib/core/libimagrt/src/configuration.rs +++ b/lib/core/libimagrt/src/configuration.rs @@ -121,10 +121,10 @@ pub fn override_config(val: &mut Value, v: Vec) -> Result<()> { .map(|(k, v)| { let value = val.read_mut(&k) .context(EM::TomlQueryError)? - .ok_or_else(|| Error::from(err_msg("No config value there, cannot override.")))?; + .ok_or_else(|| err_msg("No config value there, cannot override."))?; let new_value = into_value(value, v) - .ok_or_else(|| Error::from(err_msg("Config override type not matching")))?; + .ok_or_else(|| err_msg("Config override type not matching"))?; info!("Successfully overridden: {} = {}", k, new_value); *value = new_value; diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs index 468d798b..1f2da580 100644 --- a/lib/core/libimagrt/src/logger.rs +++ b/lib/core/libimagrt/src/logger.rs @@ -90,18 +90,18 @@ impl ImagLogger { { use self::log_lvl_aggregate::*; - let _ = aggregate::(&mut handlebars, config, "TRACE")?; - let _ = aggregate::(&mut handlebars, config, "DEBUG")?; - let _ = aggregate::(&mut handlebars, config, "INFO")?; - let _ = aggregate::(&mut handlebars, config, "WARN")?; - let _ = aggregate::(&mut handlebars, config, "ERROR")?; + aggregate::(&mut handlebars, config, "TRACE")?; + aggregate::(&mut handlebars, config, "DEBUG")?; + aggregate::(&mut handlebars, config, "INFO")?; + aggregate::(&mut handlebars, config, "WARN")?; + aggregate::(&mut handlebars, config, "ERROR")?; } Ok(ImagLogger { global_loglevel : aggregate_global_loglevel(matches, config)?, global_destinations : aggregate_global_destinations(config)?, module_settings : aggregate_module_settings(matches, config)?, - handlebars : handlebars, + handlebars, }) } @@ -171,12 +171,12 @@ impl Log for ImagLogger { if set { module_setting.destinations.as_ref().map(|destinations| for d in destinations { // If there's an error, we cannot do anything, can we? - let _ = log_to_destination(&d); + log_to_destination(&d); }); for d in self.global_destinations.iter() { // If there's an error, we cannot do anything, can we? - let _ = log_to_destination(&d); + log_to_destination(&d); } } }) @@ -185,7 +185,7 @@ impl Log for ImagLogger { // Yes, we log for d in self.global_destinations.iter() { // If there's an error, we cannot do anything, can we? - let _ = log_to_destination(&d); + log_to_destination(&d); } } }); @@ -199,7 +199,7 @@ fn match_log_level_str(s: &str) -> Result { "info" => Ok(Level::Info), "warn" => Ok(Level::Warn), "error" => Ok(Level::Error), - lvl => return Err(format_err!("Invalid logging level: {}", lvl)), + lvl => Err(format_err!("Invalid logging level: {}", lvl)), } } @@ -287,7 +287,7 @@ fn aggregate_global_destinations(config: Option<&Value>) .as_array() .ok_or_else(|| { let msg = "Type error at 'imag.logging.destinations', expected 'Array'"; - Error::from(err_msg(msg)) + err_msg(msg) }) .and_then(translate_destinations), } diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index 89b2009d..4bbca09b 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -153,8 +153,8 @@ impl<'a> Runtime<'a> { store_result.map(|store| Runtime { cli_matches: matches, configuration: config, - rtp: rtp, - store: store, + rtp, + store, has_output_pipe, has_input_pipe, @@ -381,10 +381,10 @@ impl<'a> Runtime<'a> { .map(String::from) .ok_or_else(|| { self.config() - .ok_or_else(|| Error::from(err_msg("No Configuration!"))) + .ok_or_else(|| err_msg("No Configuration!")) .and_then(|v| match v.read("rt.editor")? { Some(&Value::String(ref s)) => Ok(Some(s.clone())), - Some(_) => Err(Error::from(err_msg("Type error at 'rt.editor', expected 'String'"))), + Some(_) => Err(err_msg("Type error at 'rt.editor', expected 'String'")), None => Ok(None), }) }) @@ -617,7 +617,7 @@ fn get_override_specs(matches: &ArgMatches) -> Vec { .map(|values| { values .filter(|s| { - let b = s.contains("="); + let b = s.contains('='); if !b { warn!("override '{}' does not contain '=' - will be ignored!", s); } b })