@@ -26,7 +26,7 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
26
26
use rustc_span:: symbol:: Ident ;
27
27
use rustc_span:: { sym, Loc , Span , Symbol } ;
28
28
use serde:: { ser:: SerializeStruct , Serialize , Serializer } ;
29
- use std:: collections:: BinaryHeap ;
29
+ use std:: collections:: { BTreeSet , BinaryHeap } ;
30
30
use std:: fmt;
31
31
use std:: fmt:: Write as _;
32
32
use std:: fs:: { self , OpenOptions } ;
@@ -264,6 +264,9 @@ struct LintMetadata {
264
264
/// This field is only used in the output and will only be
265
265
/// mapped shortly before the actual output.
266
266
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 > ,
267
270
}
268
271
269
272
impl LintMetadata {
@@ -283,6 +286,7 @@ impl LintMetadata {
283
286
version,
284
287
docs,
285
288
applicability : None ,
289
+ former_ids : BTreeSet :: new ( ) ,
286
290
}
287
291
}
288
292
}
@@ -901,6 +905,7 @@ fn collect_renames(lints: &mut Vec<LintMetadata>) {
901
905
if name == lint_name;
902
906
if let Some ( past_name) = k. strip_prefix( CLIPPY_LINT_GROUP_PREFIX ) ;
903
907
then {
908
+ lint. former_ids. insert( past_name. to_owned( ) ) ;
904
909
writeln!( collected, "* `{past_name}`" ) . unwrap( ) ;
905
910
names. push( past_name. to_string( ) ) ;
906
911
}
0 commit comments