Skip to content

Commit 4c2a57b

Browse files
committed
fmt
1 parent 4505b65 commit 4c2a57b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

clippy_lints/src/missing_fields_in_debug.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn check_enum<'tcx>(
210210
span_notes.push((pat.span, "more unused fields here due to rest pattern `..`"));
211211
},
212212
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 `..`"));
214214
},
215215
_ => {},
216216
});
@@ -249,23 +249,19 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldInDebug {
249249
&& let Res::Def(DefKind::Trait, trait_def_id) = trait_ref.path.res
250250
&& let TyKind::Path(QPath::Resolved(_, self_path)) = &self_ty.kind
251251
&& cx.match_def_path(trait_def_id, &[sym::core, sym::fmt, sym::Debug])
252-
253252
// don't trigger if this impl was derived
254253
&& !cx.tcx.has_attr(item.owner_id, sym::automatically_derived)
255254
&& !item.span.from_expansion()
256-
257255
// find `Debug::fmt` function
258256
&& let Some(fmt_item) = items.iter().find(|i| i.ident.name == sym::fmt)
259257
&& let ImplItem { kind: ImplItemKind::Fn(_, body_id), .. } = cx.tcx.hir().impl_item(fmt_item.id)
260258
&& let body = cx.tcx.hir().body(*body_id)
261259
&& let ExprKind::Block(block, _) = body.value.kind
262-
263260
// inspect `self`
264261
&& let self_ty = cx.tcx.type_of(self_path.res.def_id()).0.peel_refs()
265262
&& let Some(self_adt) = self_ty.ty_adt_def()
266263
&& let Some(self_def_id) = self_adt.did().as_local()
267264
&& let Some(Node::Item(self_item)) = cx.tcx.hir().find_by_def_id(self_def_id)
268-
269265
// NB: can't call cx.typeck_results() as we are not in a body
270266
&& let typeck_results = cx.tcx.typeck_body(*body_id)
271267
&& should_lint(cx, typeck_results, block)

0 commit comments

Comments
 (0)