@@ -13,7 +13,7 @@ use super::PTR_CAST_CONSTNESS;
13
13
pub ( super ) fn check < ' tcx > (
14
14
cx : & LateContext < ' _ > ,
15
15
expr : & Expr < ' _ > ,
16
- cast_expr : & Expr < ' _ > ,
16
+ cast_from_expr : & Expr < ' _ > ,
17
17
cast_from : Ty < ' tcx > ,
18
18
cast_to : Ty < ' tcx > ,
19
19
msrv : Msrv ,
@@ -24,12 +24,12 @@ pub(super) fn check<'tcx>(
24
24
&& from_ty == to_ty
25
25
&& !from_ty. has_erased_regions ( )
26
26
{
27
- if let ExprKind :: Call ( func, [ ] ) = cast_expr . kind
27
+ if let ExprKind :: Call ( func, [ ] ) = cast_from_expr . kind
28
28
&& let ExprKind :: Path ( QPath :: Resolved ( None , path) ) = func. kind
29
29
&& let Some ( defid) = path. res . opt_def_id ( )
30
30
&& let Some ( prefix) = std_or_core ( cx)
31
31
&& let mut app = Applicability :: MachineApplicable
32
- && let sugg = snippet_with_applicability ( cx, cast_expr . span , "_" , & mut app)
32
+ && let sugg = snippet_with_applicability ( cx, cast_from_expr . span , "_" , & mut app)
33
33
&& let Some ( ( _, after_lt) ) = sugg. split_once ( "::<" )
34
34
&& let Some ( ( source, target, target_func) ) = match cx. tcx . get_diagnostic_name ( defid) {
35
35
Some ( sym:: ptr_null) => Some ( ( "const" , "mutable" , "null_mut" ) ) ,
@@ -51,7 +51,7 @@ pub(super) fn check<'tcx>(
51
51
52
52
if msrv. meets ( cx, msrvs:: POINTER_CAST_CONSTNESS ) {
53
53
let mut app = Applicability :: MachineApplicable ;
54
- let sugg = Sugg :: hir_with_context ( cx, cast_expr , expr. span . ctxt ( ) , "_" , & mut app) ;
54
+ let sugg = Sugg :: hir_with_context ( cx, cast_from_expr , expr. span . ctxt ( ) , "_" , & mut app) ;
55
55
let constness = to_mutbl. ptr_str ( ) ;
56
56
57
57
span_lint_and_sugg (
@@ -68,8 +68,8 @@ pub(super) fn check<'tcx>(
68
68
}
69
69
70
70
pub ( super ) fn check_null_ptr_cast_method ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
71
- if let ExprKind :: MethodCall ( method, cast_expr , [ ] , _) = expr. kind
72
- && let ExprKind :: Call ( func, [ ] ) = cast_expr . kind
71
+ if let ExprKind :: MethodCall ( method, cast_from_expr , [ ] , _) = expr. kind
72
+ && let ExprKind :: Call ( func, [ ] ) = cast_from_expr . kind
73
73
&& let ExprKind :: Path ( QPath :: Resolved ( None , path) ) = func. kind
74
74
&& let Some ( defid) = path. res . opt_def_id ( )
75
75
&& let method = match ( cx. tcx . get_diagnostic_name ( defid) , method. ident . name ) {
@@ -79,7 +79,7 @@ pub(super) fn check_null_ptr_cast_method(cx: &LateContext<'_>, expr: &Expr<'_>)
79
79
}
80
80
&& let Some ( prefix) = std_or_core ( cx)
81
81
&& let mut app = Applicability :: MachineApplicable
82
- && let sugg = snippet_with_applicability ( cx, cast_expr . span , "_" , & mut app)
82
+ && let sugg = snippet_with_applicability ( cx, cast_from_expr . span , "_" , & mut app)
83
83
&& let Some ( ( _, after_lt) ) = sugg. split_once ( "::<" )
84
84
{
85
85
span_lint_and_sugg (
0 commit comments