@@ -84,7 +84,7 @@ struct MarkSymbolVisitor<'tcx> {
84
84
// maps from ADTs to ignored derived traits (e.g. Debug and Clone)
85
85
// and the span of their respective impl (i.e., part of the derive
86
86
// macro)
87
- ignored_derived_traits : LocalDefIdMap < FxIndexSet < ( DefId , DefId ) > > ,
87
+ ignored_derived_traits : LocalDefIdMap < FxIndexSet < DefId > > ,
88
88
}
89
89
90
90
impl < ' tcx > MarkSymbolVisitor < ' tcx > {
@@ -380,10 +380,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
380
380
if let ty:: Adt ( adt_def, _) = trait_ref. self_ty ( ) . kind ( )
381
381
&& let Some ( adt_def_id) = adt_def. did ( ) . as_local ( )
382
382
{
383
- self . ignored_derived_traits
384
- . entry ( adt_def_id)
385
- . or_default ( )
386
- . insert ( ( trait_of, impl_of) ) ;
383
+ self . ignored_derived_traits . entry ( adt_def_id) . or_default ( ) . insert ( trait_of) ;
387
384
}
388
385
return true ;
389
386
}
@@ -881,7 +878,7 @@ fn create_and_seed_worklist(
881
878
fn live_symbols_and_ignored_derived_traits (
882
879
tcx : TyCtxt < ' _ > ,
883
880
( ) : ( ) ,
884
- ) -> ( LocalDefIdSet , LocalDefIdMap < FxIndexSet < ( DefId , DefId ) > > ) {
881
+ ) -> ( LocalDefIdSet , LocalDefIdMap < FxIndexSet < DefId > > ) {
885
882
let ( worklist, struct_constructors, mut unsolved_items) = create_and_seed_worklist ( tcx) ;
886
883
let mut symbol_visitor = MarkSymbolVisitor {
887
884
worklist,
@@ -925,7 +922,7 @@ struct DeadItem {
925
922
struct DeadVisitor < ' tcx > {
926
923
tcx : TyCtxt < ' tcx > ,
927
924
live_symbols : & ' tcx LocalDefIdSet ,
928
- ignored_derived_traits : & ' tcx LocalDefIdMap < FxIndexSet < ( DefId , DefId ) > > ,
925
+ ignored_derived_traits : & ' tcx LocalDefIdMap < FxIndexSet < DefId > > ,
929
926
}
930
927
931
928
enum ShouldWarnAboutField {
@@ -1047,20 +1044,18 @@ impl<'tcx> DeadVisitor<'tcx> {
1047
1044
let encl_def_id = get_parent_if_enum_variant ( tcx, encl_def_id) ;
1048
1045
1049
1046
let ignored_derived_impls =
1050
- if let Some ( ign_traits ) = self . ignored_derived_traits . get ( & encl_def_id) {
1047
+ self . ignored_derived_traits . get ( & encl_def_id) . map ( |ign_traits| {
1051
1048
let trait_list = ign_traits
1052
1049
. iter ( )
1053
- . map ( |( trait_id, _ ) | self . tcx . item_name ( * trait_id) )
1050
+ . map ( |trait_id| self . tcx . item_name ( * trait_id) )
1054
1051
. collect :: < Vec < _ > > ( ) ;
1055
1052
let trait_list_len = trait_list. len ( ) ;
1056
- Some ( IgnoredDerivedImpls {
1053
+ IgnoredDerivedImpls {
1057
1054
name : self . tcx . item_name ( encl_def_id. to_def_id ( ) ) ,
1058
1055
trait_list : trait_list. into ( ) ,
1059
1056
trait_list_len,
1060
- } )
1061
- } else {
1062
- None
1063
- } ;
1057
+ }
1058
+ } ) ;
1064
1059
1065
1060
let enum_variants_with_same_name = dead_codes
1066
1061
. iter ( )
0 commit comments