aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/expr.rs8
-rw-r--r--crates/ra_hir/src/ty/snapshots/tests__infer_array.snap14
-rw-r--r--crates/ra_hir/src/ty/tests.rs1
3 files changed, 15 insertions, 8 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index b01d53e5c..f2d9af2ba 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -615,10 +615,10 @@ impl ExprCollector {
615 .map(|arm| MatchArm { 615 .map(|arm| MatchArm {
616 pats: arm.pats().map(|p| self.collect_pat(p)).collect(), 616 pats: arm.pats().map(|p| self.collect_pat(p)).collect(),
617 expr: self.collect_expr_opt(arm.expr()), 617 expr: self.collect_expr_opt(arm.expr()),
618 guard: arm.guard().map(|guard| { 618 guard: arm
619 let e = guard.expr().expect("every guard should have an expr"); 619 .guard()
620 self.collect_expr(e) 620 .and_then(|guard| guard.expr())
621 }), 621 .map(|e| self.collect_expr(e)),
622 }) 622 })
623 .collect() 623 .collect()
624 } else { 624 } else {
diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap
index 3f2faa598..042248c35 100644
--- a/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap
+++ b/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap
@@ -1,12 +1,12 @@
1--- 1---
2created: "2019-01-22T14:44:59.880187500+00:00" 2created: "2019-01-30T20:08:05.185312835+00:00"
3creator: insta@0.4.0 3creator: insta@0.5.2
4expression: "&result" 4expression: "&result"
5source: "crates\\ra_hir\\src\\ty\\tests.rs" 5source: crates/ra_hir/src/ty/tests.rs
6--- 6---
7[9; 10) 'x': &str 7[9; 10) 'x': &str
8[18; 19) 'y': isize 8[18; 19) 'y': isize
9[28; 293) '{ ... []; }': () 9[28; 324) '{ ... 3]; }': ()
10[38; 39) 'a': [&str] 10[38; 39) 'a': [&str]
11[42; 45) '[x]': [&str] 11[42; 45) '[x]': [&str]
12[43; 44) 'x': &str 12[43; 44) 'x': &str
@@ -56,4 +56,10 @@ source: "crates\\ra_hir\\src\\ty\\tests.rs"
56[260; 263) '"b"': &str 56[260; 263) '"b"': &str
57[275; 276) 'x': [u8] 57[275; 276) 'x': [u8]
58[288; 290) '[]': [u8] 58[288; 290) '[]': [u8]
59[300; 301) 'z': &[u8]
60[311; 321) '&[1, 2, 3]': &[u8]
61[312; 321) '[1, 2, 3]': [u8]
62[313; 314) '1': u8
63[316; 317) '2': u8
64[319; 320) '3': u8
59 65
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 8aa188059..812d1238c 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -366,6 +366,7 @@ fn test(x: &str, y: isize) {
366 366
367 let b = [a, ["b"]]; 367 let b = [a, ["b"]];
368 let x: [u8; 0] = []; 368 let x: [u8; 0] = [];
369 let z: &[u8] = &[1, 2, 3];
369} 370}
370"#, 371"#,
371 ); 372 );