1
Fork 0

hir: Remove hir::Map::{opt_parent_id,parent_id,get_parent,find_parent}

This commit is contained in:
Vadim Petrochenkov 2024-02-09 23:58:36 +03:00
parent e46e3e7107
commit b07283815b
78 changed files with 233 additions and 318 deletions

View file

@ -144,15 +144,14 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
match &ty.kind {
TyKind::Path(QPath::Resolved(_, path)) => {
if lint_ty_kind_usage(cx, &path.res) {
let hir = cx.tcx.hir();
let span = match hir.find_parent(ty.hir_id) {
Some(Node::Pat(Pat {
let span = match cx.tcx.parent_hir_node(ty.hir_id) {
Node::Pat(Pat {
kind:
PatKind::Path(qpath)
| PatKind::TupleStruct(qpath, ..)
| PatKind::Struct(qpath, ..),
..
})) => {
}) => {
if let QPath::TypeRelative(qpath_ty, ..) = qpath
&& qpath_ty.hir_id == ty.hir_id
{
@ -161,7 +160,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
None
}
}
Some(Node::Expr(Expr { kind: ExprKind::Path(qpath), .. })) => {
Node::Expr(Expr { kind: ExprKind::Path(qpath), .. }) => {
if let QPath::TypeRelative(qpath_ty, ..) = qpath
&& qpath_ty.hir_id == ty.hir_id
{
@ -172,7 +171,7 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
}
// Can't unify these two branches because qpath below is `&&` and above is `&`
// and `A | B` paths don't play well together with adjustments, apparently.
Some(Node::Expr(Expr { kind: ExprKind::Struct(qpath, ..), .. })) => {
Node::Expr(Expr { kind: ExprKind::Struct(qpath, ..), .. }) => {
if let QPath::TypeRelative(qpath_ty, ..) = qpath
&& qpath_ty.hir_id == ty.hir_id
{