Skip to content

Commit 96d0406

Browse files
committed
Handle documenting a lint that was renamed to a group
1 parent e9db3c7 commit 96d0406

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/tools/lint-docs/src/groups.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[
3232
),
3333
];
3434

35+
pub fn exists(name: &str) -> bool {
36+
GROUP_DESCRIPTIONS.iter().any(|&(n, _)| n == name)
37+
}
38+
3539
type LintGroups = BTreeMap<String, BTreeSet<String>>;
3640

3741
impl<'a> LintExtractor<'a> {

src/tools/lint-docs/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,15 @@ impl<'a> LintExtractor<'a> {
584584
fn add_renamed_lints(lints: &mut Vec<Lint>) {
585585
for (level, names) in RENAMES {
586586
for (from, to) in *names {
587+
let doc = if groups::exists(to) {
588+
format!("The lint `{from}` has been renamed to the group `{to}`.")
589+
} else {
590+
format!("The lint `{from}` has been renamed to [`{to}`](#{to}).")
591+
};
592+
587593
lints.push(Lint {
588594
name: from.to_string(),
589-
doc: vec![format!("The lint `{from}` has been renamed to [`{to}`](#{to}).")],
595+
doc: vec![doc],
590596
level: *level,
591597
path: PathBuf::new(),
592598
lineno: 0,

0 commit comments

Comments
 (0)