]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/ptr_eq.rs
Rollup merge of #85760 - ChrisDenton:path-doc-platform-specific, r=m-ou-se
[rust.git] / src / tools / clippy / clippy_lints / src / ptr_eq.rs
index 5796c59c8b3fb6a53a1c6c3eddc5b78f19bf1404..77cfa3f6b176cd076c433af4c607a9fbd5d23cf9 100644 (file)
@@ -46,11 +46,11 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
             return;
         }
 
-        if let ExprKind::Binary(ref op, ref left, ref right) = expr.kind {
+        if let ExprKind::Binary(ref op, left, right) = expr.kind {
             if BinOpKind::Eq == op.node {
                 let (left, right) = match (expr_as_cast_to_usize(cx, left), expr_as_cast_to_usize(cx, right)) {
                     (Some(lhs), Some(rhs)) => (lhs, rhs),
-                    _ => (&**left, &**right),
+                    _ => (left, right),
                 };
 
                 if_chain! {
@@ -79,7 +79,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
 // E.g., `foo as *const _ as usize` returns `foo as *const _`.
 fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
     if cx.typeck_results().expr_ty(cast_expr) == cx.tcx.types.usize {
-        if let ExprKind::Cast(ref expr, _) = cast_expr.kind {
+        if let ExprKind::Cast(expr, _) = cast_expr.kind {
             return Some(expr);
         }
     }
@@ -90,7 +90,7 @@ fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>
 // E.g., `foo as *const _` returns `foo`.
 fn expr_as_cast_to_raw_pointer<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
     if cx.typeck_results().expr_ty(cast_expr).is_unsafe_ptr() {
-        if let ExprKind::Cast(ref expr, _) = cast_expr.kind {
+        if let ExprKind::Cast(expr, _) = cast_expr.kind {
             return Some(expr);
         }
     }