1
Fork 0

rustc_lint: Prevent multiple 'lint ignored' lints

Prevent multiple 'ignored unless specified at crate level' lints. The
multiplication happens because we run the same lint three times:
* In BuiltinCombinedEarlyLintPass
* In BuiltinCombinedPreExpansionLintPass
* In shallow_lint_levels_on

Only run the lint one time by checking the `lint_added_lints` bool.
This commit is contained in:
Martin Nordholts 2023-12-28 18:03:16 +01:00
parent eef02c453f
commit e0c626fbbc
3 changed files with 4 additions and 58 deletions

View file

@ -1029,7 +1029,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
}
}
if !is_crate_node {
if self.lint_added_lints && !is_crate_node {
for (id, &(level, ref src)) in self.current_specs().iter() {
if !id.lint.crate_level_only {
continue;