diff options
| author | Philipp Krones <hello@philkrones.com> | 2025-01-10 16:45:08 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-10 16:45:08 +0000 |
| commit | fc0e65d15731f34fc28514de1800477d1ba479b9 (patch) | |
| tree | bf474ebe0c92681b98a139aac29e541cb37906c2 | |
| parent | cccb006cc08601c05680516cc28e1b57a5ee5f28 (diff) | |
| parent | c9315bc3953fcf15154df21f788f2f7a5e8d6e7d (diff) | |
| download | rust-fc0e65d15731f34fc28514de1800477d1ba479b9.tar.gz rust-fc0e65d15731f34fc28514de1800477d1ba479b9.zip | |
Use diagnostic item instead of path for `core::fmt::Debug` (#13949)
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
| -rw-r--r-- | clippy_lints/src/missing_fields_in_debug.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/missing_fields_in_debug.rs b/clippy_lints/src/missing_fields_in_debug.rs index f28b431ab99..e9ec23b1efa 100644 --- a/clippy_lints/src/missing_fields_in_debug.rs +++ b/clippy_lints/src/missing_fields_in_debug.rs @@ -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() |
