about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2025-08-08 17:01:57 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2025-08-08 17:28:19 -0500
commiteec8585f656e853901ff6c1106d1f15456bfac41 (patch)
treebc09b858673f0c218d146cce54cbe56723b4e2b3 /compiler/rustc_lint/src
parent2886b36df4a646dd8d82fb65bf0c9d8d96c1f71a (diff)
downloadrust-eec8585f656e853901ff6c1106d1f15456bfac41.tar.gz
rust-eec8585f656e853901ff6c1106d1f15456bfac41.zip
Reduce indirect assoc parent queries
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/default_could_be_derived.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/default_could_be_derived.rs b/compiler/rustc_lint/src/default_could_be_derived.rs
index 7c39d8917ce..1d92cfbc039 100644
--- a/compiler/rustc_lint/src/default_could_be_derived.rs
+++ b/compiler/rustc_lint/src/default_could_be_derived.rs
@@ -62,8 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultCouldBeDerived {
         // Look for manual implementations of `Default`.
         let Some(default_def_id) = cx.tcx.get_diagnostic_item(sym::Default) else { return };
         let hir::ImplItemKind::Fn(_sig, body_id) = impl_item.kind else { return };
-        let assoc = cx.tcx.associated_item(impl_item.owner_id);
-        let parent = assoc.container_id(cx.tcx);
+        let parent = cx.tcx.parent(impl_item.owner_id.to_def_id());
         if find_attr!(cx.tcx.get_all_attrs(parent), AttributeKind::AutomaticallyDerived(..)) {
             // We don't care about what `#[derive(Default)]` produces in this lint.
             return;