]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/unnamed_address.rs
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / unnamed_address.rs
index b9aa202b328f6aad2637a20ed45697858e3352f6..25d136e564d3ee8bd8e4633d3c33915ef502c91f 100644 (file)
 impl LateLintPass<'_> for UnnamedAddress {
     fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
         fn is_comparison(binop: BinOpKind) -> bool {
-            match binop {
-                BinOpKind::Eq | BinOpKind::Lt | BinOpKind::Le | BinOpKind::Ne | BinOpKind::Ge | BinOpKind::Gt => true,
-                _ => false,
-            }
+            matches!(
+                binop,
+                BinOpKind::Eq | BinOpKind::Lt | BinOpKind::Le | BinOpKind::Ne | BinOpKind::Ge | BinOpKind::Gt
+            )
         }
 
         fn is_trait_ptr(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
@@ -72,11 +72,7 @@ fn is_trait_ptr(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
         }
 
         fn is_fn_def(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
-            if let ty::FnDef(..) = cx.tables().expr_ty(expr).kind {
-                true
-            } else {
-                false
-            }
+            matches!(cx.tables().expr_ty(expr).kind, ty::FnDef(..))
         }
 
         if_chain! {