Skip to content

Commit

Permalink
Merge some patterns together
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 18, 2024
1 parent 37e7459 commit 9ee1695
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions compiler/rustc_lint/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,11 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
| PatKind::TupleStruct(qpath, ..)
| PatKind::Struct(qpath, ..),
..
}) => {
if let QPath::TypeRelative(qpath_ty, ..) = qpath
&& qpath_ty.hir_id == ty.hir_id
{
Some(path.span)
} else {
None
}
}
Node::Expr(Expr { kind: ExprKind::Path(qpath), .. }) => {
if let QPath::TypeRelative(qpath_ty, ..) = qpath
&& qpath_ty.hir_id == ty.hir_id
{
Some(path.span)
} else {
None
}
}
// 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.
Node::Expr(Expr { kind: ExprKind::Struct(qpath, ..), .. }) => {
})
| Node::Expr(
Expr { kind: ExprKind::Path(qpath), .. }
| &Expr { kind: ExprKind::Struct(qpath, ..), .. },
) => {
if let QPath::TypeRelative(qpath_ty, ..) = qpath
&& qpath_ty.hir_id == ty.hir_id
{
Expand Down

0 comments on commit 9ee1695

Please sign in to comment.