about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSuchith J N <suchithjn22@gmail.com>2017-04-15 17:21:53 +0530
committerSuchith J N <suchithjn22@gmail.com>2017-04-15 17:21:53 +0530
commit65b04fa06869cecfbb8d76a8c8a2456aa1f3686e (patch)
tree17ea025778448c57d84e7dad513f900424927f75 /src
parent4ac11becc2cb716d65cb3ebe5f13d3846ef78b93 (diff)
downloadrust-65b04fa06869cecfbb8d76a8c8a2456aa1f3686e.tar.gz
rust-65b04fa06869cecfbb8d76a8c8a2456aa1f3686e.zip
Fixed aesthetics and test
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/lowering.rs8
-rw-r--r--src/test/run-pass/issue-41272.rs10
2 files changed, 12 insertions, 6 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 994364ba181..a6d10c5ab90 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -2051,10 +2051,10 @@ impl<'a> LoweringContext<'a> {
                     let wildcard_arm: Option<&Expr> = else_opt.as_ref().map(|p| &**p);
                     let wildcard_pattern = self.pat_wild(e.span);
                     let body = if let Some(else_expr) = wildcard_arm {
-                            P(self.lower_expr(else_expr))
-                        } else {
-                            self.expr_tuple(e.span, hir_vec![])
-                        };
+                                   P(self.lower_expr(else_expr))
+                               } else {
+                                   self.expr_tuple(e.span, hir_vec![])
+                               };
                     arms.push(self.arm(hir_vec![wildcard_pattern], body));
                 }
 
diff --git a/src/test/run-pass/issue-41272.rs b/src/test/run-pass/issue-41272.rs
index d0834a26ae7..d6a0034690a 100644
--- a/src/test/run-pass/issue-41272.rs
+++ b/src/test/run-pass/issue-41272.rs
@@ -14,10 +14,16 @@ impl Foo {
     fn bar(&mut self) -> bool { true }
 }
 
-/* This causes E0301. By fixing issue #41272 this problem should vanish */
-fn iflet_issue(foo: &mut Foo) {
+fn error(foo: &mut Foo) {
     if let Some(_) = Some(true) {
     } else if foo.bar() {}
 }
 
+fn ok(foo: &mut Foo) {
+    if let Some(_) = Some(true) {
+    } else {
+        if foo.bar() {}
+    }
+}
+
 fn main() {}