]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/temporary_assignment.rs
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / temporary_assignment.rs
index 509bbfd27c1a5094184e4bbf775e631d89e445d2..1aeff1baa362e24a2362263c07a946e412abde46 100644 (file)
 fn is_temporary(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
     match &expr.kind {
         ExprKind::Struct(..) | ExprKind::Tup(..) => true,
-        ExprKind::Path(qpath) => {
-            if let Res::Def(DefKind::Const, ..) = cx.qpath_res(qpath, expr.hir_id) {
-                true
-            } else {
-                false
-            }
-        },
+        ExprKind::Path(qpath) => matches!(cx.qpath_res(qpath, expr.hir_id), Res::Def(DefKind::Const, ..)),
         _ => false,
     }
 }