We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
match
1 parent 0cdb47d commit d4a6061Copy full SHA for d4a6061
clippy_lints/src/casts/ptr_as_ptr.rs
@@ -4,7 +4,7 @@ use clippy_utils::msrvs::{self, Msrv};
4
use clippy_utils::source::snippet_with_applicability;
5
use clippy_utils::sugg::Sugg;
6
use rustc_errors::Applicability;
7
-use rustc_hir::{self as hir, Expr, ExprKind, Mutability, QPath, TyKind};
+use rustc_hir::{self as hir, Expr, ExprKind, QPath, TyKind};
8
use rustc_lint::LateContext;
9
use rustc_middle::ty::{self, Ty};
10
use rustc_span::{Span, sym};
@@ -37,8 +37,7 @@ pub(super) fn check<'tcx>(
37
) {
38
if let ty::RawPtr(_, from_mutbl) = cast_from.kind()
39
&& 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))
+ && from_mutbl == to_mutbl
42
// The `U` in `pointer::cast` have to be `Sized`
43
// as explained here: https://github.com/rust-lang/rust/issues/60602.
44
&& to_pointee_ty.is_sized(cx.tcx, cx.typing_env())
0 commit comments