Skip to content

Commit 0b696c0

Browse files
authored
Merge pull request #22054 from jdrouet/jdrouet/remove-duplicate-lints
fix(21943): remove duplicate lints
2 parents c41c134 + 07cf5e4 commit 0b696c0

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

crates/ide-db/src/generated/lints.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,13 +1804,6 @@ pub const DEFAULT_LINTS: &[Lint] = &[
18041804
warn_since: None,
18051805
deny_since: None,
18061806
},
1807-
Lint {
1808-
label: "warnings",
1809-
description: r##"lint group for: all lints that are set to issue warnings"##,
1810-
default_severity: Severity::Allow,
1811-
warn_since: None,
1812-
deny_since: None,
1813-
},
18141807
];
18151808

18161809
pub const DEFAULT_LINT_GROUPS: &[LintGroup] = &[

xtask/src/codegen/lints.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![allow(clippy::disallowed_types)]
44

55
use std::{
6-
collections::{HashMap, hash_map},
6+
collections::{HashMap, HashSet, hash_map},
77
fs,
88
path::Path,
99
str::FromStr,
@@ -348,10 +348,12 @@ fn generate_lint_descriptor(sh: &Shell, buf: &mut String) {
348348
buf.push_str(r#"pub const DEFAULT_LINTS: &[Lint] = &["#);
349349
buf.push('\n');
350350

351+
let mut known_lints: HashSet<&String> = HashSet::with_capacity(lints.len() + lint_groups.len());
351352
for (name, lint) in &lints {
352353
push_lint_completion(buf, name, lint);
354+
known_lints.insert(name);
353355
}
354-
for (name, (group, _)) in &lint_groups {
356+
for (name, (group, _)) in lint_groups.iter().filter(|(name, _)| !known_lints.contains(name)) {
355357
push_lint_completion(buf, name, group);
356358
}
357359
buf.push_str("];\n\n");
@@ -372,10 +374,15 @@ fn generate_lint_descriptor(sh: &Shell, buf: &mut String) {
372374
buf.push_str(r#"pub const RUSTDOC_LINTS: &[Lint] = &["#);
373375
buf.push('\n');
374376

377+
let mut known_rustdoc_lints: HashSet<&String> =
378+
HashSet::with_capacity(lints_rustdoc.len() + lint_groups_rustdoc.len());
375379
for (name, lint) in &lints_rustdoc {
376380
push_lint_completion(buf, name, lint);
381+
known_rustdoc_lints.insert(name);
377382
}
378-
for (name, (group, _)) in &lint_groups_rustdoc {
383+
for (name, (group, _)) in
384+
lint_groups_rustdoc.iter().filter(|(name, _)| !known_rustdoc_lints.contains(name))
385+
{
379386
push_lint_completion(buf, name, group);
380387
}
381388
buf.push_str("];\n\n");

0 commit comments

Comments
 (0)