Fixed aesthetics and test
This commit is contained in:
parent
4ac11becc2
commit
65b04fa068
2 changed files with 12 additions and 6 deletions
|
@ -2051,10 +2051,10 @@ impl<'a> LoweringContext<'a> {
|
||||||
let wildcard_arm: Option<&Expr> = else_opt.as_ref().map(|p| &**p);
|
let wildcard_arm: Option<&Expr> = else_opt.as_ref().map(|p| &**p);
|
||||||
let wildcard_pattern = self.pat_wild(e.span);
|
let wildcard_pattern = self.pat_wild(e.span);
|
||||||
let body = if let Some(else_expr) = wildcard_arm {
|
let body = if let Some(else_expr) = wildcard_arm {
|
||||||
P(self.lower_expr(else_expr))
|
P(self.lower_expr(else_expr))
|
||||||
} else {
|
} else {
|
||||||
self.expr_tuple(e.span, hir_vec![])
|
self.expr_tuple(e.span, hir_vec![])
|
||||||
};
|
};
|
||||||
arms.push(self.arm(hir_vec![wildcard_pattern], body));
|
arms.push(self.arm(hir_vec![wildcard_pattern], body));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,16 @@ impl Foo {
|
||||||
fn bar(&mut self) -> bool { true }
|
fn bar(&mut self) -> bool { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This causes E0301. By fixing issue #41272 this problem should vanish */
|
fn error(foo: &mut Foo) {
|
||||||
fn iflet_issue(foo: &mut Foo) {
|
|
||||||
if let Some(_) = Some(true) {
|
if let Some(_) = Some(true) {
|
||||||
} else if foo.bar() {}
|
} else if foo.bar() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ok(foo: &mut Foo) {
|
||||||
|
if let Some(_) = Some(true) {
|
||||||
|
} else {
|
||||||
|
if foo.bar() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue