Skip to content

Commit

Permalink
Use diagnostic item instead of path for core::fmt::Debug (#13949)
Browse files Browse the repository at this point in the history
This removes the last call to `LateContext::match_def_path()` in
Clippy's code. The `LateContext::match_def_path()` in the compiler
sources was only kept for Clippy's usage.

Once this PR is merged and after the rustup, I will submit one to remove
`LateContext::match_def_path()` from the compiler.

changelog: none

r? @flip1995
  • Loading branch information
flip1995 authored Jan 10, 2025
2 parents cccb006 + c9315bc commit fc0e65d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_fields_in_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingFieldsInDebug {
// this prevents ICEs such as when self is a type parameter or a primitive type
// (see #10887, #11063)
&& let Res::Def(DefKind::Struct | DefKind::Enum | DefKind::Union, self_path_did) = self_path.res
&& cx.match_def_path(trait_def_id, &[sym::core, sym::fmt, sym::Debug])
&& cx.tcx.is_diagnostic_item(sym::Debug, trait_def_id)
// don't trigger if this impl was derived
&& !cx.tcx.has_attr(item.owner_id, sym::automatically_derived)
&& !item.span.from_expansion()
Expand Down

0 comments on commit fc0e65d

Please sign in to comment.