Skip to content

Commit 54a9168

Browse files
committed
Remove useless pattern matching
1 parent 42106e0 commit 54a9168

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

clippy_lints/src/transmute/transmute_null_to_fn.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'t
2121
// Catching transmute over constants that resolve to `null`.
2222
let mut const_eval_context = constant_context(cx, cx.typeck_results());
2323
if let ExprKind::Path(ref _qpath) = arg.kind &&
24-
let Some(Constant::RawPtr(x)) = const_eval_context.expr(arg) &&
25-
x == 0
24+
let Some(Constant::RawPtr(0)) = const_eval_context.expr(arg)
2625
{
2726
span_lint_and_then(cx, TRANSMUTE_NULL_TO_FN, expr.span, LINT_MSG, |diag| {
2827
diag.span_label(expr.span, NOTE_MSG);

clippy_lints/src/transmute/transmuting_null.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'t
1818
// Catching transmute over constants that resolve to `null`.
1919
let mut const_eval_context = constant_context(cx, cx.typeck_results());
2020
if let ExprKind::Path(ref _qpath) = arg.kind &&
21-
let Some(Constant::RawPtr(x)) = const_eval_context.expr(arg) &&
22-
x == 0
21+
let Some(Constant::RawPtr(0)) = const_eval_context.expr(arg)
2322
{
2423
span_lint(cx, TRANSMUTING_NULL, expr.span, LINT_MSG);
2524
return true;

0 commit comments

Comments
 (0)