fix: apply clippy suggestions (#1756)

This commit is contained in:
Tilmann Meyer
2020-10-13 18:03:33 +02:00
committed by GitHub
parent 967ae28f61
commit d1e2c13a7c
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -229,7 +229,7 @@ impl<'a> StringFormatter<'a> {
StyleElement::Variable(name) => { StyleElement::Variable(name) => {
let variable = variables.get(name.as_ref()).unwrap_or(&None); let variable = variables.get(name.as_ref()).unwrap_or(&None);
match variable { match variable {
Some(style_string) => style_string.clone().map(|string| string), Some(style_string) => style_string.clone(),
None => Ok("".into()), None => Ok("".into()),
} }
} }
+4 -4
View File
@@ -37,7 +37,7 @@ pub fn get_prompt(context: Context) -> String {
formatter formatter
} else { } else {
log::error!("Error parsing `format`"); log::error!("Error parsing `format`");
buf.push_str(">"); buf.push('>');
return buf; return buf;
}; };
let modules = formatter.get_variables(); let modules = formatter.get_variables();
@@ -295,11 +295,11 @@ fn handle_module<'a>(
.collect::<Vec<Option<Module<'a>>>>(); .collect::<Vec<Option<Module<'a>>>>();
modules.extend(custom_modules) modules.extend(custom_modules)
} }
} else if module.starts_with("custom.") { } else if let Some(module) = module.strip_prefix("custom.") {
// Write out a custom module if it isn't disabled (and it exists...) // Write out a custom module if it isn't disabled (and it exists...)
match context.is_custom_module_disabled_in_config(&module[7..]) { match context.is_custom_module_disabled_in_config(&module) {
Some(true) => (), // Module is disabled, we don't add it to the prompt Some(true) => (), // Module is disabled, we don't add it to the prompt
Some(false) => modules.push(modules::custom::module(&module[7..], &context)), Some(false) => modules.push(modules::custom::module(&module, &context)),
None => match context.config.get_custom_modules() { None => match context.config.get_custom_modules() {
Some(modules) => log::debug!( Some(modules) => log::debug!(
"top level format contains custom module \"{}\", but no configuration was provided. Configuration for the following modules were provided: {:?}", "top level format contains custom module \"{}\", but no configuration was provided. Configuration for the following modules were provided: {:?}",