diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-01-25 19:16:38 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-01-30 15:00:52 +0300 |
| commit | c0f49a9995d82163cbd6282a3dd38b990e71ccce (patch) | |
| tree | b441a98d8a6d43e81220537075ec15504f519911 | |
| parent | a51fc2a80ec55721425c8ccf445d050e858a0800 (diff) | |
| download | rust-c0f49a9995d82163cbd6282a3dd38b990e71ccce.tar.gz rust-c0f49a9995d82163cbd6282a3dd38b990e71ccce.zip | |
hir: Simplify `hir_owner_nodes` query
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`.
| -rw-r--r-- | clippy_lints/src/min_ident_chars.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/min_ident_chars.rs b/clippy_lints/src/min_ident_chars.rs index 34b8e0dbe6a..2b0063f62d9 100644 --- a/clippy_lints/src/min_ident_chars.rs +++ b/clippy_lints/src/min_ident_chars.rs @@ -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) |
