Skip to content

Commit fa87f63

Browse files
committed
rewrite using let-chains
1 parent e2b377c commit fa87f63

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,18 +1119,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11191119
_,
11201120
hir::Path { res: hir::def::Res::Local(bind_hir_id), .. },
11211121
)) = expr.kind
1122-
{
1123-
let bind = self.tcx.hir_node(*bind_hir_id);
1124-
let parent = self.tcx.parent_hir_node(*bind_hir_id);
1125-
if let hir::Node::Pat(hir::Pat {
1122+
&& let bind = self.tcx.hir_node(*bind_hir_id)
1123+
&& let parent = self.tcx.parent_hir_node(*bind_hir_id)
1124+
&& let hir::Node::Pat(hir::Pat {
11261125
kind: hir::PatKind::Binding(_, _hir_id, _, _), ..
11271126
}) = bind
1128-
&& let hir::Node::Pat(hir::Pat { default_binding_modes: false, .. }) = parent
1129-
{
1130-
return true;
1131-
}
1127+
&& let hir::Node::Pat(hir::Pat { default_binding_modes: false, .. }) = parent
1128+
{
1129+
true
1130+
} else {
1131+
false
11321132
}
1133-
false
11341133
}
11351134

11361135
fn explain_self_literal(

0 commit comments

Comments
 (0)