]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/invalid_upcast_comparisons.rs
Auto merge of #7256 - xFrednet:7172-trick-cargos-caching-for-collection, r=flip1995
[rust.git] / clippy_lints / src / invalid_upcast_comparisons.rs
index d183fc41f315314f549709c7a41131a625d25526..aafdebef2480dc19f22aa94ef6adf6069cae29fb 100644 (file)
@@ -86,7 +86,7 @@ fn cmp(&self, other: &Self) -> Ordering {
 }
 
 fn numeric_cast_precast_bounds<'a>(cx: &LateContext<'_>, expr: &'a Expr<'_>) -> Option<(FullInt, FullInt)> {
-    if let ExprKind::Cast(ref cast_exp, _) = expr.kind {
+    if let ExprKind::Cast(cast_exp, _) = expr.kind {
         let pre_cast_ty = cx.typeck_results().expr_ty(cast_exp);
         let cast_ty = cx.typeck_results().expr_ty(expr);
         // if it's a cast from i32 to u32 wrapping will invalidate all these checks
@@ -131,7 +131,7 @@ fn node_as_const_fullint<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) ->
 }
 
 fn err_upcast_comparison(cx: &LateContext<'_>, span: Span, expr: &Expr<'_>, always: bool) {
-    if let ExprKind::Cast(ref cast_val, _) = expr.kind {
+    if let ExprKind::Cast(cast_val, _) = expr.kind {
         span_lint(
             cx,
             INVALID_UPCAST_COMPARISONS,
@@ -177,7 +177,7 @@ fn upcast_comparison_bounds_err<'tcx>(
                 },
                 Rel::Eq | Rel::Ne => unreachable!(),
             } {
-                err_upcast_comparison(cx, span, lhs, true)
+                err_upcast_comparison(cx, span, lhs, true);
             } else if match rel {
                 Rel::Lt => {
                     if invert {
@@ -195,7 +195,7 @@ fn upcast_comparison_bounds_err<'tcx>(
                 },
                 Rel::Eq | Rel::Ne => unreachable!(),
             } {
-                err_upcast_comparison(cx, span, lhs, false)
+                err_upcast_comparison(cx, span, lhs, false);
             }
         }
     }
@@ -203,7 +203,7 @@ fn upcast_comparison_bounds_err<'tcx>(
 
 impl<'tcx> LateLintPass<'tcx> for InvalidUpcastComparisons {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
-        if let ExprKind::Binary(ref cmp, ref lhs, ref rhs) = expr.kind {
+        if let ExprKind::Binary(ref cmp, lhs, rhs) = expr.kind {
             let normalized = comparisons::normalize_comparison(cmp.node, lhs, rhs);
             let (rel, normalized_lhs, normalized_rhs) = if let Some(val) = normalized {
                 val