Update clippy_lints/src/casts/ptr_cast_constness.rs

Co-authored-by: llogiq <bogusandre@gmail.com>
This commit is contained in:
Catherine 2023-05-15 13:14:45 -05:00 committed by GitHub
parent c5a914b181
commit f6a0437e74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,8 +21,8 @@ pub(super) fn check(
if msrv.meets(RustcVersion::new(1,65,0));
if let ty::RawPtr(TypeAndMut { mutbl: from_mutbl, .. }) = cast_from.kind();
if let ty::RawPtr(TypeAndMut { mutbl: to_mutbl, .. }) = cast_to.kind();
if !matches!((from_mutbl, to_mutbl),
(Mutability::Not, Mutability::Not) | (Mutability::Mut, Mutability::Mut));
if matches!((from_mutbl, to_mutbl),
(Mutability::Not, Mutability::Mut) | (Mutability::Mut, Mutability::Not));
then {
let sugg = Sugg::hir(cx, cast_expr, "_");
let constness = match *to_mutbl {