Skip to content

Commit a94aac6

Browse files
Refactor to make following commit pass single_match_else lint
1 parent 87b5f89 commit a94aac6

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

clippy_lints/src/lib.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -497,24 +497,23 @@ pub(crate) struct LintInfo {
497497

498498
pub fn explain(name: &str) {
499499
let target = format!("clippy::{}", name.to_ascii_uppercase());
500-
match declared_lints::LINTS.iter().find(|info| info.lint.name == target) {
501-
Some(info) => {
502-
println!("{}", info.explanation);
503-
// Check if the lint has configuration
504-
let mdconf = get_configuration_metadata();
505-
if let Some(config_vec_positions) = mdconf
506-
.iter()
507-
.find_all(|cconf| cconf.lints.contains(&info.lint.name_lower()[8..].to_owned()))
508-
{
509-
// If it has, print it
510-
println!("### Configuration for {}:\n", info.lint.name_lower());
511-
for position in config_vec_positions {
512-
let conf = &mdconf[position];
513-
println!(" - {}: {} (default: {})", conf.name, conf.doc, conf.default);
514-
}
500+
if let Some(info) = declared_lints::LINTS.iter().find(|info| info.lint.name == target) {
501+
println!("{}", info.explanation);
502+
// Check if the lint has configuration
503+
let mdconf = get_configuration_metadata();
504+
if let Some(config_vec_positions) = mdconf
505+
.iter()
506+
.find_all(|cconf| cconf.lints.contains(&info.lint.name_lower()[8..].to_owned()))
507+
{
508+
// If it has, print it
509+
println!("### Configuration for {}:\n", info.lint.name_lower());
510+
for position in config_vec_positions {
511+
let conf = &mdconf[position];
512+
println!(" - {}: {} (default: {})", conf.name, conf.doc, conf.default);
515513
}
516-
},
517-
None => println!("unknown lint: {name}"),
514+
}
515+
} else {
516+
println!("unknown lint: {name}");
518517
}
519518
}
520519

0 commit comments

Comments
 (0)