@@ -26,7 +26,7 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
2626use rustc_span:: symbol:: Ident ;
2727use rustc_span:: { sym, Loc , Span , Symbol } ;
2828use serde:: { ser:: SerializeStruct , Serialize , Serializer } ;
29- use std:: collections:: BinaryHeap ;
29+ use std:: collections:: { BTreeSet , BinaryHeap } ;
3030use std:: fmt;
3131use std:: fmt:: Write as _;
3232use std:: fs:: { self , OpenOptions } ;
@@ -264,6 +264,9 @@ struct LintMetadata {
264264 /// This field is only used in the output and will only be
265265 /// mapped shortly before the actual output.
266266 applicability : Option < ApplicabilityInfo > ,
267+ /// All the past names of lints which have been renamed.
268+ #[ serde( skip_serializing_if = "BTreeSet::is_empty" ) ]
269+ former_ids : BTreeSet < String > ,
267270}
268271
269272impl LintMetadata {
@@ -283,6 +286,7 @@ impl LintMetadata {
283286 version,
284287 docs,
285288 applicability : None ,
289+ former_ids : BTreeSet :: new ( ) ,
286290 }
287291 }
288292}
@@ -901,6 +905,7 @@ fn collect_renames(lints: &mut Vec<LintMetadata>) {
901905 if name == lint_name;
902906 if let Some ( past_name) = k. strip_prefix( CLIPPY_LINT_GROUP_PREFIX ) ;
903907 then {
908+ lint. former_ids. insert( past_name. to_owned( ) ) ;
904909 writeln!( collected, "* `{past_name}`" ) . unwrap( ) ;
905910 names. push( past_name. to_string( ) ) ;
906911 }
0 commit comments