diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-08-09 13:58:55 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-09 13:58:55 +1000 |
| commit | d88a309114fa72fa667b5b8078624c8d17035f91 (patch) | |
| tree | d2ae79a14bb38a3bbb86eb0d9ff93aa32aec9748 /compiler/rustc_lint/src | |
| parent | 484141038aece61b5f335df841211a3601ac8c01 (diff) | |
| parent | eec8585f656e853901ff6c1106d1f15456bfac41 (diff) | |
| download | rust-d88a309114fa72fa667b5b8078624c8d17035f91.tar.gz rust-d88a309114fa72fa667b5b8078624c8d17035f91.zip | |
Rollup merge of #145134 - camsteffen:indirect-assoc-parent, r=cjgillot
Reduce indirect assoc parent queries Simplify some code that uses multiple queries to get the parent of an associated item.
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/default_could_be_derived.rs | 3 |
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; |
