[Auto] lib/core/rt: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:45:23 +02:00 committed by Matthias Beyer
parent f0a734839d
commit c7ac440c92
3 changed files with 18 additions and 18 deletions

View file

@ -121,10 +121,10 @@ pub fn override_config(val: &mut Value, v: Vec<String>) -> 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;

View file

@ -90,18 +90,18 @@ impl ImagLogger {
{
use self::log_lvl_aggregate::*;
let _ = aggregate::<Trace>(&mut handlebars, config, "TRACE")?;
let _ = aggregate::<Debug>(&mut handlebars, config, "DEBUG")?;
let _ = aggregate::<Info>(&mut handlebars, config, "INFO")?;
let _ = aggregate::<Warn>(&mut handlebars, config, "WARN")?;
let _ = aggregate::<Error>(&mut handlebars, config, "ERROR")?;
aggregate::<Trace>(&mut handlebars, config, "TRACE")?;
aggregate::<Debug>(&mut handlebars, config, "DEBUG")?;
aggregate::<Info>(&mut handlebars, config, "INFO")?;
aggregate::<Warn>(&mut handlebars, config, "WARN")?;
aggregate::<Error>(&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<Level> {
"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),
}

View file

@ -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<String> {
.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
})