Skip to content

Commit d4a6061

Browse files
committed
misc: replace match with an equality check
that's all it was doing
1 parent 0cdb47d commit d4a6061

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clippy_lints/src/casts/ptr_as_ptr.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::msrvs::{self, Msrv};
44
use clippy_utils::source::snippet_with_applicability;
55
use clippy_utils::sugg::Sugg;
66
use rustc_errors::Applicability;
7-
use rustc_hir::{self as hir, Expr, ExprKind, Mutability, QPath, TyKind};
7+
use rustc_hir::{self as hir, Expr, ExprKind, QPath, TyKind};
88
use rustc_lint::LateContext;
99
use rustc_middle::ty::{self, Ty};
1010
use rustc_span::{Span, sym};
@@ -37,8 +37,7 @@ pub(super) fn check<'tcx>(
3737
) {
3838
if let ty::RawPtr(_, from_mutbl) = cast_from.kind()
3939
&& let ty::RawPtr(to_pointee_ty, to_mutbl) = cast_to.kind()
40-
&& matches!((from_mutbl, to_mutbl),
41-
(Mutability::Not, Mutability::Not) | (Mutability::Mut, Mutability::Mut))
40+
&& from_mutbl == to_mutbl
4241
// The `U` in `pointer::cast` have to be `Sized`
4342
// as explained here: https://github.com/rust-lang/rust/issues/60602.
4443
&& to_pointee_ty.is_sized(cx.tcx, cx.typing_env())

0 commit comments

Comments
 (0)