Skip to content

Commit b03642e

Browse files
committed
Metadata collection clarifying default configuration values
1 parent 88ae2d1 commit b03642e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

clippy_lints/src/utils/internal_lints/metadata_collector.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,22 @@ fn collect_configs() -> Vec<ClippyConfiguration> {
290290
lints,
291291
doc,
292292
config_type: x.config_type,
293-
default: x.default.to_string(),
293+
default: clarify_default(x.default),
294294
}
295295
})
296296
.collect()
297297
}
298298

299+
fn clarify_default(default: &'static str) -> String {
300+
if let Some((_start, init)) = default.split_once('[') {
301+
if let Some((init, _end)) = init.split_once(']') {
302+
return format!("[{}]", init);
303+
}
304+
}
305+
306+
default.to_string()
307+
}
308+
299309
/// This parses the field documentation of the config struct.
300310
///
301311
/// ```rust, ignore

0 commit comments

Comments
 (0)