diff options
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/diagnostics.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 977c0525b..0b3e16ae7 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -33,6 +33,10 @@ pub struct NoSuchField { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | impl Diagnostic for NoSuchField { | 35 | impl Diagnostic for NoSuchField { |
36 | fn name(&self) -> String { | ||
37 | "no-such-field".to_string() | ||
38 | } | ||
39 | |||
36 | fn message(&self) -> String { | 40 | fn message(&self) -> String { |
37 | "no such field".to_string() | 41 | "no such field".to_string() |
38 | } | 42 | } |
@@ -64,6 +68,9 @@ pub struct MissingFields { | |||
64 | } | 68 | } |
65 | 69 | ||
66 | impl Diagnostic for MissingFields { | 70 | impl Diagnostic for MissingFields { |
71 | fn name(&self) -> String { | ||
72 | "missing-structure-fields".to_string() | ||
73 | } | ||
67 | fn message(&self) -> String { | 74 | fn message(&self) -> String { |
68 | let mut buf = String::from("Missing structure fields:\n"); | 75 | let mut buf = String::from("Missing structure fields:\n"); |
69 | for field in &self.missed_fields { | 76 | for field in &self.missed_fields { |
@@ -97,6 +104,9 @@ pub struct MissingPatFields { | |||
97 | } | 104 | } |
98 | 105 | ||
99 | impl Diagnostic for MissingPatFields { | 106 | impl Diagnostic for MissingPatFields { |
107 | fn name(&self) -> String { | ||
108 | "missing-pat-fields".to_string() | ||
109 | } | ||
100 | fn message(&self) -> String { | 110 | fn message(&self) -> String { |
101 | let mut buf = String::from("Missing structure fields:\n"); | 111 | let mut buf = String::from("Missing structure fields:\n"); |
102 | for field in &self.missed_fields { | 112 | for field in &self.missed_fields { |
@@ -120,6 +130,9 @@ pub struct MissingMatchArms { | |||
120 | } | 130 | } |
121 | 131 | ||
122 | impl Diagnostic for MissingMatchArms { | 132 | impl Diagnostic for MissingMatchArms { |
133 | fn name(&self) -> String { | ||
134 | "missing-match-arm".to_string() | ||
135 | } | ||
123 | fn message(&self) -> String { | 136 | fn message(&self) -> String { |
124 | String::from("Missing match arm") | 137 | String::from("Missing match arm") |
125 | } | 138 | } |
@@ -138,6 +151,9 @@ pub struct MissingOkInTailExpr { | |||
138 | } | 151 | } |
139 | 152 | ||
140 | impl Diagnostic for MissingOkInTailExpr { | 153 | impl Diagnostic for MissingOkInTailExpr { |
154 | fn name(&self) -> String { | ||
155 | "missing-ok-in-tail-expr".to_string() | ||
156 | } | ||
141 | fn message(&self) -> String { | 157 | fn message(&self) -> String { |
142 | "wrap return expression in Ok".to_string() | 158 | "wrap return expression in Ok".to_string() |
143 | } | 159 | } |
@@ -166,6 +182,9 @@ pub struct BreakOutsideOfLoop { | |||
166 | } | 182 | } |
167 | 183 | ||
168 | impl Diagnostic for BreakOutsideOfLoop { | 184 | impl Diagnostic for BreakOutsideOfLoop { |
185 | fn name(&self) -> String { | ||
186 | "break-outside-of-loop".to_string() | ||
187 | } | ||
169 | fn message(&self) -> String { | 188 | fn message(&self) -> String { |
170 | "break outside of loop".to_string() | 189 | "break outside of loop".to_string() |
171 | } | 190 | } |
@@ -194,6 +213,9 @@ pub struct MissingUnsafe { | |||
194 | } | 213 | } |
195 | 214 | ||
196 | impl Diagnostic for MissingUnsafe { | 215 | impl Diagnostic for MissingUnsafe { |
216 | fn name(&self) -> String { | ||
217 | "missing-unsafe".to_string() | ||
218 | } | ||
197 | fn message(&self) -> String { | 219 | fn message(&self) -> String { |
198 | format!("This operation is unsafe and requires an unsafe function or block") | 220 | format!("This operation is unsafe and requires an unsafe function or block") |
199 | } | 221 | } |
@@ -224,6 +246,9 @@ pub struct MismatchedArgCount { | |||
224 | } | 246 | } |
225 | 247 | ||
226 | impl Diagnostic for MismatchedArgCount { | 248 | impl Diagnostic for MismatchedArgCount { |
249 | fn name(&self) -> String { | ||
250 | "mismatched-arg-count".to_string() | ||
251 | } | ||
227 | fn message(&self) -> String { | 252 | fn message(&self) -> String { |
228 | let s = if self.expected == 1 { "" } else { "s" }; | 253 | let s = if self.expected == 1 { "" } else { "s" }; |
229 | format!("Expected {} argument{}, found {}", self.expected, s, self.found) | 254 | format!("Expected {} argument{}, found {}", self.expected, s, self.found) |