Skip to content

Commit cc6180c

Browse files
committed
Include former name of renamed lints in lints.json
1 parent 113c704 commit cc6180c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clippy_lints/src/utils/internal_lints/metadata_collector.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
2626
use rustc_span::symbol::Ident;
2727
use rustc_span::{sym, Loc, Span, Symbol};
2828
use serde::{ser::SerializeStruct, Serialize, Serializer};
29-
use std::collections::BinaryHeap;
29+
use std::collections::{BTreeSet, BinaryHeap};
3030
use std::fmt;
3131
use std::fmt::Write as _;
3232
use 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

269272
impl 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

Comments
 (0)