Metadata collection clarifying default configuration values

This commit is contained in:
xFrednet 2021-05-12 17:30:04 +02:00
parent 88ae2d1155
commit b03642e51f

View file

@ -290,12 +290,22 @@ fn collect_configs() -> Vec<ClippyConfiguration> {
lints,
doc,
config_type: x.config_type,
default: x.default.to_string(),
default: clarify_default(x.default),
}
})
.collect()
}
fn clarify_default(default: &'static str) -> String {
if let Some((_start, init)) = default.split_once('[') {
if let Some((init, _end)) = init.split_once(']') {
return format!("[{}]", init);
}
}
default.to_string()
}
/// This parses the field documentation of the config struct.
///
/// ```rust, ignore