33#![ allow( clippy:: disallowed_types) ]
44
55use 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