diff options
author | Aleksey Kladov <[email protected]> | 2021-06-13 19:44:31 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-13 19:44:31 +0100 |
commit | b292e1b9da39813e2739cb450c263e7502c97c8d (patch) | |
tree | 92a09f547c7d7ca41f90ebdc68f0f81ac1805560 /crates/hir/src/diagnostics.rs | |
parent | 3478897f86cc1b3e3f83e9d4e7cedff41721fb04 (diff) |
internal: refactor missing match arms diagnostics
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r-- | crates/hir/src/diagnostics.rs | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs index c2d608eb5..5cffef47f 100644 --- a/crates/hir/src/diagnostics.rs +++ b/crates/hir/src/diagnostics.rs | |||
@@ -38,6 +38,7 @@ diagnostics![ | |||
38 | MacroError, | 38 | MacroError, |
39 | MismatchedArgCount, | 39 | MismatchedArgCount, |
40 | MissingFields, | 40 | MissingFields, |
41 | MissingMatchArms, | ||
41 | MissingOkOrSomeInTailExpr, | 42 | MissingOkOrSomeInTailExpr, |
42 | MissingUnsafe, | 43 | MissingUnsafe, |
43 | NoSuchField, | 44 | NoSuchField, |
@@ -149,9 +150,6 @@ pub struct MissingOkOrSomeInTailExpr { | |||
149 | pub required: String, | 150 | pub required: String, |
150 | } | 151 | } |
151 | 152 | ||
152 | // Diagnostic: missing-match-arm | ||
153 | // | ||
154 | // This diagnostic is triggered if `match` block is missing one or more match arms. | ||
155 | #[derive(Debug)] | 153 | #[derive(Debug)] |
156 | pub struct MissingMatchArms { | 154 | pub struct MissingMatchArms { |
157 | pub file: HirFileId, | 155 | pub file: HirFileId, |
@@ -159,21 +157,6 @@ pub struct MissingMatchArms { | |||
159 | pub arms: AstPtr<ast::MatchArmList>, | 157 | pub arms: AstPtr<ast::MatchArmList>, |
160 | } | 158 | } |
161 | 159 | ||
162 | impl Diagnostic for MissingMatchArms { | ||
163 | fn code(&self) -> DiagnosticCode { | ||
164 | DiagnosticCode("missing-match-arm") | ||
165 | } | ||
166 | fn message(&self) -> String { | ||
167 | String::from("Missing match arm") | ||
168 | } | ||
169 | fn display_source(&self) -> InFile<SyntaxNodePtr> { | ||
170 | InFile { file_id: self.file, value: self.match_expr.clone().into() } | ||
171 | } | ||
172 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
173 | self | ||
174 | } | ||
175 | } | ||
176 | |||
177 | #[derive(Debug)] | 160 | #[derive(Debug)] |
178 | pub struct InternalBailedOut { | 161 | pub struct InternalBailedOut { |
179 | pub file: HirFileId, | 162 | pub file: HirFileId, |