Skip to content

Commit

Permalink
hir: Simplify hir_owner_nodes query
Browse files Browse the repository at this point in the history
The query accept arbitrary DefIds, not just owner DefIds.
The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom.
Also rename the query to `opt_hir_owner_nodes`.
  • Loading branch information
petrochenkov committed Jan 30, 2024
1 parent a51fc2a commit c0f49a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/min_ident_chars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Visitor<'_> for IdentVisitor<'_, '_> {
// reimplement it even if we wanted to
cx.tcx.opt_hir_node(hir_id)
} else {
let Some(owner) = cx.tcx.hir_owner_nodes(hir_id.owner).as_owner() else {
let Some(owner) = cx.tcx.opt_hir_owner_nodes(hir_id.owner) else {
return;
};
owner.nodes.get(hir_id.local_id).copied().flatten().map(|p| p.node)
Expand Down

0 comments on commit c0f49a9

Please sign in to comment.