@@ -210,7 +210,7 @@ fn check_enum<'tcx>(
210
210
span_notes. push ( ( pat. span , "more unused fields here due to rest pattern `..`" ) ) ;
211
211
} ,
212
212
PatKind :: Struct ( .., true ) => {
213
- span_notes. push ( ( pat. span , "more unused fields here due to rest pattern `..`" ) )
213
+ span_notes. push ( ( pat. span , "more unused fields here due to rest pattern `..`" ) ) ;
214
214
} ,
215
215
_ => { } ,
216
216
} ) ;
@@ -249,23 +249,19 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldInDebug {
249
249
&& let Res :: Def ( DefKind :: Trait , trait_def_id) = trait_ref. path . res
250
250
&& let TyKind :: Path ( QPath :: Resolved ( _, self_path) ) = & self_ty. kind
251
251
&& cx. match_def_path ( trait_def_id, & [ sym:: core, sym:: fmt, sym:: Debug ] )
252
-
253
252
// don't trigger if this impl was derived
254
253
&& !cx. tcx . has_attr ( item. owner_id , sym:: automatically_derived)
255
254
&& !item. span . from_expansion ( )
256
-
257
255
// find `Debug::fmt` function
258
256
&& let Some ( fmt_item) = items. iter ( ) . find ( |i| i. ident . name == sym:: fmt)
259
257
&& let ImplItem { kind : ImplItemKind :: Fn ( _, body_id) , .. } = cx. tcx . hir ( ) . impl_item ( fmt_item. id )
260
258
&& let body = cx. tcx . hir ( ) . body ( * body_id)
261
259
&& let ExprKind :: Block ( block, _) = body. value . kind
262
-
263
260
// inspect `self`
264
261
&& let self_ty = cx. tcx . type_of ( self_path. res . def_id ( ) ) . 0 . peel_refs ( )
265
262
&& let Some ( self_adt) = self_ty. ty_adt_def ( )
266
263
&& let Some ( self_def_id) = self_adt. did ( ) . as_local ( )
267
264
&& let Some ( Node :: Item ( self_item) ) = cx. tcx . hir ( ) . find_by_def_id ( self_def_id)
268
-
269
265
// NB: can't call cx.typeck_results() as we are not in a body
270
266
&& let typeck_results = cx. tcx . typeck_body ( * body_id)
271
267
&& should_lint ( cx, typeck_results, block)
0 commit comments