Skip to content

Commit a9883fd

Browse files
committed
s/cast_expr/cast_from_expr
for more consistency with the naming in `mod.rs`
1 parent 3c2bffc commit a9883fd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clippy_lints/src/casts/ptr_cast_constness.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::PTR_CAST_CONSTNESS;
1313
pub(super) fn check<'tcx>(
1414
cx: &LateContext<'_>,
1515
expr: &Expr<'_>,
16-
cast_expr: &Expr<'_>,
16+
cast_from_expr: &Expr<'_>,
1717
cast_from: Ty<'tcx>,
1818
cast_to: Ty<'tcx>,
1919
msrv: Msrv,
@@ -24,12 +24,12 @@ pub(super) fn check<'tcx>(
2424
&& from_ty == to_ty
2525
&& !from_ty.has_erased_regions()
2626
{
27-
if let ExprKind::Call(func, []) = cast_expr.kind
27+
if let ExprKind::Call(func, []) = cast_from_expr.kind
2828
&& let ExprKind::Path(QPath::Resolved(None, path)) = func.kind
2929
&& let Some(defid) = path.res.opt_def_id()
3030
&& let Some(prefix) = std_or_core(cx)
3131
&& 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)
3333
&& let Some((_, after_lt)) = sugg.split_once("::<")
3434
&& let Some((source, target, target_func)) = match cx.tcx.get_diagnostic_name(defid) {
3535
Some(sym::ptr_null) => Some(("const", "mutable", "null_mut")),
@@ -51,7 +51,7 @@ pub(super) fn check<'tcx>(
5151

5252
if msrv.meets(cx, msrvs::POINTER_CAST_CONSTNESS) {
5353
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);
5555
let constness = to_mutbl.ptr_str();
5656

5757
span_lint_and_sugg(
@@ -68,8 +68,8 @@ pub(super) fn check<'tcx>(
6868
}
6969

7070
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
7373
&& let ExprKind::Path(QPath::Resolved(None, path)) = func.kind
7474
&& let Some(defid) = path.res.opt_def_id()
7575
&& 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<'_>)
7979
}
8080
&& let Some(prefix) = std_or_core(cx)
8181
&& 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)
8383
&& let Some((_, after_lt)) = sugg.split_once("::<")
8484
{
8585
span_lint_and_sugg(

0 commit comments

Comments
 (0)