Skip to content

Commit 07cf5e4

Browse files
committed
fix: filter rules by names before pushing them
Signed-off-by: Jeremie Drouet <jeremie.drouet@gmail.com>
1 parent 17d028e commit 07cf5e4

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
@@ -1790,13 +1790,6 @@ pub const DEFAULT_LINTS: &[Lint] = &[
17901790
warn_since: None,
17911791
deny_since: None,
17921792
},
1793-
Lint {
1794-
label: "warnings",
1795-
description: r##"lint group for: all lints that are set to issue warnings"##,
1796-
default_severity: Severity::Allow,
1797-
warn_since: None,
1798-
deny_since: None,
1799-
},
18001793
];
18011794

18021795
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)