]> git.lizzy.rs Git - rust.git/commitdiff
fmt
authorManish Goregaokar <manishsmail@gmail.com>
Tue, 28 Sep 2021 05:33:45 +0000 (22:33 -0700)
committerManish Goregaokar <manishsmail@gmail.com>
Tue, 28 Sep 2021 05:33:45 +0000 (22:33 -0700)
clippy_lints/src/match_result_ok.rs

index 650bb167b73ca1d77a4cf967795f4fa5f0ace16b..c7de06f0815a4023f55620b01d1c3988ef60ef3c 100644 (file)
 
 impl<'tcx> LateLintPass<'tcx> for MatchResultOk {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
-        let (let_pat, let_expr, ifwhile) = if let Some(higher::IfLet { let_pat, let_expr, .. }) = higher::IfLet::hir(cx, expr) {
-            (let_pat, let_expr, "if")
-        } else if let Some(higher::WhileLet { let_pat, let_expr, .. }) = higher::WhileLet::hir(expr) {
-            (let_pat, let_expr, "while")
-        } else {
-            return
-        };
+        let (let_pat, let_expr, ifwhile) =
+            if let Some(higher::IfLet { let_pat, let_expr, .. }) = higher::IfLet::hir(cx, expr) {
+                (let_pat, let_expr, "if")
+            } else if let Some(higher::WhileLet { let_pat, let_expr, .. }) = higher::WhileLet::hir(expr) {
+                (let_pat, let_expr, "while")
+            } else {
+                return;
+            };
 
         if_chain! {
             if let ExprKind::MethodCall(_, ok_span, [ref result_types_0, ..], _) = let_expr.kind; //check is expr.ok() has type Result<T,E>.ok(, _)