Skip to content

Commit 65b04fa

Browse files
committed
Fixed aesthetics and test
1 parent 4ac11be commit 65b04fa

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/librustc/hir/lowering.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,10 +2051,10 @@ impl<'a> LoweringContext<'a> {
20512051
let wildcard_arm: Option<&Expr> = else_opt.as_ref().map(|p| &**p);
20522052
let wildcard_pattern = self.pat_wild(e.span);
20532053
let body = if let Some(else_expr) = wildcard_arm {
2054-
P(self.lower_expr(else_expr))
2055-
} else {
2056-
self.expr_tuple(e.span, hir_vec![])
2057-
};
2054+
P(self.lower_expr(else_expr))
2055+
} else {
2056+
self.expr_tuple(e.span, hir_vec![])
2057+
};
20582058
arms.push(self.arm(hir_vec![wildcard_pattern], body));
20592059
}
20602060

src/test/run-pass/issue-41272.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ impl Foo {
1414
fn bar(&mut self) -> bool { true }
1515
}
1616

17-
/* This causes E0301. By fixing issue #41272 this problem should vanish */
18-
fn iflet_issue(foo: &mut Foo) {
17+
fn error(foo: &mut Foo) {
1918
if let Some(_) = Some(true) {
2019
} else if foo.bar() {}
2120
}
2221

22+
fn ok(foo: &mut Foo) {
23+
if let Some(_) = Some(true) {
24+
} else {
25+
if foo.bar() {}
26+
}
27+
}
28+
2329
fn main() {}

0 commit comments

Comments
 (0)