@@ -243,36 +243,24 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
243
243
/// will be ignored for the purposes of dead code analysis (see PR #85200
244
244
/// for discussion).
245
245
fn should_ignore_item ( & self , def_id : DefId ) -> bool {
246
- if !self . tcx . has_attr ( def_id, sym:: automatically_derived)
247
- && !self
248
- . tcx
249
- . impl_of_method ( def_id)
250
- . map_or ( false , |impl_id| self . tcx . has_attr ( impl_id, sym:: automatically_derived) )
251
- {
252
- return false ;
253
- }
254
-
255
- let has_attr = |def_id| self . tcx . has_attr ( def_id, sym:: rustc_trivial_field_reads) ;
256
-
257
246
if let Some ( impl_of) = self . tcx . impl_of_method ( def_id) {
247
+ if !self . tcx . has_attr ( impl_of, sym:: automatically_derived) {
248
+ return false ;
249
+ }
250
+
258
251
if let Some ( trait_of) = self . tcx . trait_id_of_impl ( impl_of) {
259
- if has_attr ( trait_of) {
252
+ if self . tcx . has_attr ( trait_of, sym :: rustc_trivial_field_reads ) {
260
253
return true ;
261
254
}
262
255
}
263
- } else if let Some ( trait_of) = self . tcx . trait_of_item ( def_id) {
264
- if has_attr ( trait_of) {
265
- return true ;
266
- }
267
256
}
268
257
269
258
return false ;
270
259
}
271
260
272
261
fn visit_node ( & mut self , node : Node < ' tcx > ) {
273
262
if let Some ( item_def_id) = match node {
274
- Node :: TraitItem ( hir:: TraitItem { def_id, .. } )
275
- | Node :: ImplItem ( hir:: ImplItem { def_id, .. } ) => Some ( def_id. to_def_id ( ) ) ,
263
+ Node :: ImplItem ( hir:: ImplItem { def_id, .. } ) => Some ( def_id. to_def_id ( ) ) ,
276
264
_ => None ,
277
265
} {
278
266
if self . should_ignore_item ( item_def_id) {
0 commit comments