Skip to content

Commit 4ac11be

Browse files
committed
[41272] - Fixed to conform to rust project style
1 parent 65fafd9 commit 4ac11be

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/librustc/hir/lowering.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,15 +2048,14 @@ impl<'a> LoweringContext<'a> {
20482048

20492049
// _ => [<else_opt>|()]
20502050
{
2051-
let wildcard_arm: Option<&Expr> = else_opt.as_ref().map(|p| &**p);
2052-
let wildcard_pattern = self.pat_wild(e.span);
2053-
let body =
2054-
if let Some(else_expr) = wildcard_arm {
2055-
P(self.lower_expr(else_expr))
2056-
} else {
2057-
self.expr_tuple(e.span, hir_vec![])
2058-
};
2059-
arms.push(self.arm(hir_vec![wildcard_pattern], body));
2051+
let wildcard_arm: Option<&Expr> = else_opt.as_ref().map(|p| &**p);
2052+
let wildcard_pattern = self.pat_wild(e.span);
2053+
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+
};
2058+
arms.push(self.arm(hir_vec![wildcard_pattern], body));
20602059
}
20612060

20622061
let contains_else_clause = else_opt.is_some();

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
111
struct Foo;
212

313
impl Foo {

0 commit comments

Comments
 (0)