mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 04:46:58 +00:00
Uplift TypeAndMut
This commit is contained in:
parent
c8213a49bb
commit
20de341bb0
@ -10,8 +10,8 @@ use super::AS_PTR_CAST_MUT;
|
|||||||
|
|
||||||
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>, cast_to: Ty<'_>) {
|
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>, cast_to: Ty<'_>) {
|
||||||
if let ty::RawPtr(
|
if let ty::RawPtr(
|
||||||
ptrty @ TypeAndMut {
|
TypeAndMut {
|
||||||
mutbl: Mutability::Mut, ..
|
mutbl: Mutability::Mut, ty: ptrty,
|
||||||
},
|
},
|
||||||
) = cast_to.kind()
|
) = cast_to.kind()
|
||||||
&& let ty::RawPtr(TypeAndMut {
|
&& let ty::RawPtr(TypeAndMut {
|
||||||
@ -34,7 +34,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
|
|||||||
cx,
|
cx,
|
||||||
AS_PTR_CAST_MUT,
|
AS_PTR_CAST_MUT,
|
||||||
expr.span,
|
expr.span,
|
||||||
&format!("casting the result of `as_ptr` to *{ptrty}"),
|
&format!("casting the result of `as_ptr` to *mut {ptrty}"),
|
||||||
"replace with",
|
"replace with",
|
||||||
format!("{recv}.as_mut_ptr()"),
|
format!("{recv}.as_mut_ptr()"),
|
||||||
applicability,
|
applicability,
|
||||||
|
Loading…
Reference in New Issue
Block a user