diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/_match.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/diagnostics.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/expr.rs | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/_match.rs b/crates/ra_hir_ty/src/_match.rs index f502a9208..02472e0c0 100644 --- a/crates/ra_hir_ty/src/_match.rs +++ b/crates/ra_hir_ty/src/_match.rs | |||
@@ -545,7 +545,7 @@ mod tests { | |||
545 | 545 | ||
546 | assert_snapshot!( | 546 | assert_snapshot!( |
547 | check_diagnostic_message(content), | 547 | check_diagnostic_message(content), |
548 | @"\"{\\n }\": Missing match arm\n" | 548 | @"\"()\": Missing match arm\n" |
549 | ); | 549 | ); |
550 | } | 550 | } |
551 | 551 | ||
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 3457905e2..8cbce1168 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -65,6 +65,7 @@ impl AstDiagnostic for MissingFields { | |||
65 | #[derive(Debug)] | 65 | #[derive(Debug)] |
66 | pub struct MissingMatchArms { | 66 | pub struct MissingMatchArms { |
67 | pub file: HirFileId, | 67 | pub file: HirFileId, |
68 | pub match_expr: AstPtr<ast::Expr>, | ||
68 | pub arms: AstPtr<ast::MatchArmList>, | 69 | pub arms: AstPtr<ast::MatchArmList>, |
69 | } | 70 | } |
70 | 71 | ||
@@ -73,7 +74,7 @@ impl Diagnostic for MissingMatchArms { | |||
73 | String::from("Missing match arm") | 74 | String::from("Missing match arm") |
74 | } | 75 | } |
75 | fn source(&self) -> InFile<SyntaxNodePtr> { | 76 | fn source(&self) -> InFile<SyntaxNodePtr> { |
76 | InFile { file_id: self.file, value: self.arms.into() } | 77 | InFile { file_id: self.file, value: self.match_expr.into() } |
77 | } | 78 | } |
78 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 79 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
79 | self | 80 | self |
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index 6efed6f9e..19323fda1 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs | |||
@@ -125,9 +125,12 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
125 | if let Some(expr) = source_ptr.value.left() { | 125 | if let Some(expr) = source_ptr.value.left() { |
126 | let root = source_ptr.file_syntax(db.upcast()); | 126 | let root = source_ptr.file_syntax(db.upcast()); |
127 | if let ast::Expr::MatchExpr(match_expr) = expr.to_node(&root) { | 127 | if let ast::Expr::MatchExpr(match_expr) = expr.to_node(&root) { |
128 | if let Some(arms) = match_expr.match_arm_list() { | 128 | if let (Some(match_expr), Some(arms)) = |
129 | (match_expr.expr(), match_expr.match_arm_list()) | ||
130 | { | ||
129 | self.sink.push(MissingMatchArms { | 131 | self.sink.push(MissingMatchArms { |
130 | file: source_ptr.file_id, | 132 | file: source_ptr.file_id, |
133 | match_expr: AstPtr::new(&match_expr), | ||
131 | arms: AstPtr::new(&arms), | 134 | arms: AstPtr::new(&arms), |
132 | }) | 135 | }) |
133 | } | 136 | } |