diff options
Diffstat (limited to 'compiler/rustc_lint/src/levels.rs')
| -rw-r--r-- | compiler/rustc_lint/src/levels.rs | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index b335f330f5d..500b1f36558 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -4,7 +4,7 @@ use crate::context::{CheckLintNameResult, LintStore}; use crate::late::unerased_lint_store; use crate::lints::{ DeprecatedLintName, IgnoredUnlessCrateSpecified, OverruledAtributeLint, RenamedOrRemovedLint, - UnknownLint, + RenamedOrRemovedLintSuggestion, UnknownLint, UnknownLintSuggestion, }; use rustc_ast as ast; use rustc_ast_pretty::pprust; @@ -887,10 +887,15 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { _ if !self.warn_about_weird_lints => {} CheckLintNameResult::Warning(msg, renamed) => { + let suggestion = + renamed.as_ref().map(|replace| RenamedOrRemovedLintSuggestion { + suggestion: sp, + replace: replace.as_str(), + }); self.emit_spanned_lint( RENAMED_AND_REMOVED_LINTS, sp.into(), - RenamedOrRemovedLint { msg, suggestion: sp, renamed }, + RenamedOrRemovedLint { msg, suggestion }, ); } CheckLintNameResult::NoLint(suggestion) => { @@ -899,10 +904,12 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { } else { name.to_string() }; + let suggestion = suggestion + .map(|replace| UnknownLintSuggestion { suggestion: sp, replace }); self.emit_spanned_lint( UNKNOWN_LINTS, sp.into(), - UnknownLint { name, suggestion: sp, replace: suggestion }, + UnknownLint { name, suggestion }, ); } } | 
