[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:
parent
f0a734839d
commit
c7ac440c92
3 changed files with 18 additions and 18 deletions
|
@ -121,10 +121,10 @@ pub fn override_config(val: &mut Value, v: Vec<String>) -> Result<()> {
|
||||||
.map(|(k, v)| {
|
.map(|(k, v)| {
|
||||||
let value = val.read_mut(&k)
|
let value = val.read_mut(&k)
|
||||||
.context(EM::TomlQueryError)?
|
.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)
|
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);
|
info!("Successfully overridden: {} = {}", k, new_value);
|
||||||
*value = new_value;
|
*value = new_value;
|
||||||
|
|
|
@ -90,18 +90,18 @@ impl ImagLogger {
|
||||||
|
|
||||||
{
|
{
|
||||||
use self::log_lvl_aggregate::*;
|
use self::log_lvl_aggregate::*;
|
||||||
let _ = aggregate::<Trace>(&mut handlebars, config, "TRACE")?;
|
aggregate::<Trace>(&mut handlebars, config, "TRACE")?;
|
||||||
let _ = aggregate::<Debug>(&mut handlebars, config, "DEBUG")?;
|
aggregate::<Debug>(&mut handlebars, config, "DEBUG")?;
|
||||||
let _ = aggregate::<Info>(&mut handlebars, config, "INFO")?;
|
aggregate::<Info>(&mut handlebars, config, "INFO")?;
|
||||||
let _ = aggregate::<Warn>(&mut handlebars, config, "WARN")?;
|
aggregate::<Warn>(&mut handlebars, config, "WARN")?;
|
||||||
let _ = aggregate::<Error>(&mut handlebars, config, "ERROR")?;
|
aggregate::<Error>(&mut handlebars, config, "ERROR")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ImagLogger {
|
Ok(ImagLogger {
|
||||||
global_loglevel : aggregate_global_loglevel(matches, config)?,
|
global_loglevel : aggregate_global_loglevel(matches, config)?,
|
||||||
global_destinations : aggregate_global_destinations(config)?,
|
global_destinations : aggregate_global_destinations(config)?,
|
||||||
module_settings : aggregate_module_settings(matches, config)?,
|
module_settings : aggregate_module_settings(matches, config)?,
|
||||||
handlebars : handlebars,
|
handlebars,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,12 +171,12 @@ impl Log for ImagLogger {
|
||||||
if set {
|
if set {
|
||||||
module_setting.destinations.as_ref().map(|destinations| for d in destinations {
|
module_setting.destinations.as_ref().map(|destinations| for d in destinations {
|
||||||
// If there's an error, we cannot do anything, can we?
|
// 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() {
|
for d in self.global_destinations.iter() {
|
||||||
// If there's an error, we cannot do anything, can we?
|
// 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
|
// Yes, we log
|
||||||
for d in self.global_destinations.iter() {
|
for d in self.global_destinations.iter() {
|
||||||
// If there's an error, we cannot do anything, can we?
|
// 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),
|
"info" => Ok(Level::Info),
|
||||||
"warn" => Ok(Level::Warn),
|
"warn" => Ok(Level::Warn),
|
||||||
"error" => Ok(Level::Error),
|
"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()
|
.as_array()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
let msg = "Type error at 'imag.logging.destinations', expected 'Array'";
|
let msg = "Type error at 'imag.logging.destinations', expected 'Array'";
|
||||||
Error::from(err_msg(msg))
|
err_msg(msg)
|
||||||
})
|
})
|
||||||
.and_then(translate_destinations),
|
.and_then(translate_destinations),
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,8 +153,8 @@ impl<'a> Runtime<'a> {
|
||||||
store_result.map(|store| Runtime {
|
store_result.map(|store| Runtime {
|
||||||
cli_matches: matches,
|
cli_matches: matches,
|
||||||
configuration: config,
|
configuration: config,
|
||||||
rtp: rtp,
|
rtp,
|
||||||
store: store,
|
store,
|
||||||
|
|
||||||
has_output_pipe,
|
has_output_pipe,
|
||||||
has_input_pipe,
|
has_input_pipe,
|
||||||
|
@ -381,10 +381,10 @@ impl<'a> Runtime<'a> {
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
self.config()
|
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")? {
|
.and_then(|v| match v.read("rt.editor")? {
|
||||||
Some(&Value::String(ref s)) => Ok(Some(s.clone())),
|
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),
|
None => Ok(None),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -617,7 +617,7 @@ fn get_override_specs(matches: &ArgMatches) -> Vec<String> {
|
||||||
.map(|values| {
|
.map(|values| {
|
||||||
values
|
values
|
||||||
.filter(|s| {
|
.filter(|s| {
|
||||||
let b = s.contains("=");
|
let b = s.contains('=');
|
||||||
if !b { warn!("override '{}' does not contain '=' - will be ignored!", s); }
|
if !b { warn!("override '{}' does not contain '=' - will be ignored!", s); }
|
||||||
b
|
b
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue