@@ -69,8 +69,9 @@ pub struct LintStore {
6969
7070 /// Map of registered lint groups to what lints they expand to. The first
7171 /// bool is true if the lint group was added by a plugin. The optional string
72- /// is used to store the new names of deprecated lint group names.
73- lint_groups : FxHashMap < & ' static str , ( Vec < LintId > , bool , Option < & ' static str > ) > ,
72+ /// is used to store the new names of deprecated lint group names and is paired
73+ /// with `true` if the deprecation is silent.
74+ lint_groups : FxHashMap < & ' static str , ( Vec < LintId > , bool , Option < ( & ' static str , bool ) > ) > ,
7475
7576 /// Extra info for future incompatibility lints, describing the
7677 /// issue or RFC that caused the incompatibility.
@@ -160,9 +161,9 @@ impl LintStore {
160161 }
161162
162163 pub fn get_lint_groups < ' t > ( & ' t self ) -> Vec < ( & ' static str , Vec < LintId > , bool ) > {
163- self . lint_groups . iter ( ) . map ( | ( k , v ) | ( * k ,
164- v . 0 . clone ( ) ,
165- v. 1 ) ) . collect ( )
164+ self . lint_groups . iter ( )
165+ . filter ( | ( _ , ( _ , _ , d ) ) | d . is_none ( ) ) // Don't display deprecated lint groups.
166+ . map ( | ( k , v ) | ( * k , v . 0 . clone ( ) , v. 1 ) ) . collect ( )
166167 }
167168
168169 pub fn register_early_pass ( & mut self ,
@@ -245,6 +246,14 @@ impl LintStore {
245246 self . future_incompatible . get ( & id)
246247 }
247248
249+ pub fn register_group_alias (
250+ & mut self ,
251+ lint_name : & ' static str ,
252+ alias : & ' static str ,
253+ ) {
254+ self . lint_groups . insert ( alias, ( vec ! [ ] , false , Some ( ( lint_name, true ) ) ) ) ;
255+ }
256+
248257 pub fn register_group (
249258 & mut self ,
250259 sess : Option < & Session > ,
@@ -259,7 +268,7 @@ impl LintStore {
259268 . is_none ( ) ;
260269 if let Some ( deprecated) = deprecated_name {
261270 self . lint_groups
262- . insert ( deprecated, ( vec ! [ ] , from_plugin, Some ( name) ) ) ;
271+ . insert ( deprecated, ( vec ! [ ] , from_plugin, Some ( ( name, false ) ) ) ) ;
263272 }
264273
265274 if !new {
@@ -392,12 +401,16 @@ impl LintStore {
392401 None => self . check_tool_name_for_backwards_compat ( & complete_name, "clippy" ) ,
393402 Some ( ids) => {
394403 // Check if the lint group name is deprecated
395- if let Some ( new_name) = ids. 2 {
404+ if let Some ( ( new_name, silent ) ) = ids. 2 {
396405 let lint_ids = self . lint_groups . get ( new_name) . unwrap ( ) ;
397- return CheckLintNameResult :: Tool ( Err ( (
398- Some ( & lint_ids. 0 ) ,
399- new_name. to_string ( ) ,
400- ) ) ) ;
406+ return if silent {
407+ CheckLintNameResult :: Ok ( & lint_ids. 0 )
408+ } else {
409+ CheckLintNameResult :: Tool ( Err ( (
410+ Some ( & lint_ids. 0 ) ,
411+ new_name. to_string ( ) ,
412+ ) ) )
413+ } ;
401414 }
402415 CheckLintNameResult :: Ok ( & ids. 0 )
403416 }
@@ -417,13 +430,17 @@ impl LintStore {
417430 // Now we are sure, that this lint exists nowhere
418431 None => CheckLintNameResult :: NoLint ,
419432 Some ( ids) => {
420- // Reaching this would be weird, but lets cover this case anyway
421- if let Some ( new_name) = ids. 2 {
433+ // Reaching this would be weird, but let's cover this case anyway
434+ if let Some ( ( new_name, silent ) ) = ids. 2 {
422435 let lint_ids = self . lint_groups . get ( new_name) . unwrap ( ) ;
423- return CheckLintNameResult :: Tool ( Err ( (
424- Some ( & lint_ids. 0 ) ,
425- new_name. to_string ( ) ,
426- ) ) ) ;
436+ return if silent {
437+ CheckLintNameResult :: Tool ( Err ( ( Some ( & lint_ids. 0 ) , complete_name) ) )
438+ } else {
439+ CheckLintNameResult :: Tool ( Err ( (
440+ Some ( & lint_ids. 0 ) ,
441+ new_name. to_string ( ) ,
442+ ) ) )
443+ } ;
427444 }
428445 CheckLintNameResult :: Tool ( Err ( ( Some ( & ids. 0 ) , complete_name) ) )
429446 }
0 commit comments