aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/diagnostics.rs')
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs25
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 7ab7f79db..45e31033e 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
35impl Diagnostic for NoSuchField { 35impl Diagnostic for NoSuchField {
36 fn name(&self) -> &'static str {
37 "no-such-field"
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 }
@@ -55,6 +59,9 @@ pub struct MissingFields {
55} 59}
56 60
57impl Diagnostic for MissingFields { 61impl Diagnostic for MissingFields {
62 fn name(&self) -> &'static str {
63 "missing-structure-fields"
64 }
58 fn message(&self) -> String { 65 fn message(&self) -> String {
59 let mut buf = String::from("Missing structure fields:\n"); 66 let mut buf = String::from("Missing structure fields:\n");
60 for field in &self.missed_fields { 67 for field in &self.missed_fields {
@@ -88,6 +95,9 @@ pub struct MissingPatFields {
88} 95}
89 96
90impl Diagnostic for MissingPatFields { 97impl Diagnostic for MissingPatFields {
98 fn name(&self) -> &'static str {
99 "missing-pat-fields"
100 }
91 fn message(&self) -> String { 101 fn message(&self) -> String {
92 let mut buf = String::from("Missing structure fields:\n"); 102 let mut buf = String::from("Missing structure fields:\n");
93 for field in &self.missed_fields { 103 for field in &self.missed_fields {
@@ -118,6 +128,9 @@ pub struct MissingMatchArms {
118} 128}
119 129
120impl Diagnostic for MissingMatchArms { 130impl Diagnostic for MissingMatchArms {
131 fn name(&self) -> &'static str {
132 "missing-match-arm"
133 }
121 fn message(&self) -> String { 134 fn message(&self) -> String {
122 String::from("Missing match arm") 135 String::from("Missing match arm")
123 } 136 }
@@ -136,6 +149,9 @@ pub struct MissingOkInTailExpr {
136} 149}
137 150
138impl Diagnostic for MissingOkInTailExpr { 151impl Diagnostic for MissingOkInTailExpr {
152 fn name(&self) -> &'static str {
153 "missing-ok-in-tail-expr"
154 }
139 fn message(&self) -> String { 155 fn message(&self) -> String {
140 "wrap return expression in Ok".to_string() 156 "wrap return expression in Ok".to_string()
141 } 157 }
@@ -154,6 +170,9 @@ pub struct BreakOutsideOfLoop {
154} 170}
155 171
156impl Diagnostic for BreakOutsideOfLoop { 172impl Diagnostic for BreakOutsideOfLoop {
173 fn name(&self) -> &'static str {
174 "break-outside-of-loop"
175 }
157 fn message(&self) -> String { 176 fn message(&self) -> String {
158 "break outside of loop".to_string() 177 "break outside of loop".to_string()
159 } 178 }
@@ -172,6 +191,9 @@ pub struct MissingUnsafe {
172} 191}
173 192
174impl Diagnostic for MissingUnsafe { 193impl Diagnostic for MissingUnsafe {
194 fn name(&self) -> &'static str {
195 "missing-unsafe"
196 }
175 fn message(&self) -> String { 197 fn message(&self) -> String {
176 format!("This operation is unsafe and requires an unsafe function or block") 198 format!("This operation is unsafe and requires an unsafe function or block")
177 } 199 }
@@ -192,6 +214,9 @@ pub struct MismatchedArgCount {
192} 214}
193 215
194impl Diagnostic for MismatchedArgCount { 216impl Diagnostic for MismatchedArgCount {
217 fn name(&self) -> &'static str {
218 "mismatched-arg-count"
219 }
195 fn message(&self) -> String { 220 fn message(&self) -> String {
196 let s = if self.expected == 1 { "" } else { "s" }; 221 let s = if self.expected == 1 { "" } else { "s" };
197 format!("Expected {} argument{}, found {}", self.expected, s, self.found) 222 format!("Expected {} argument{}, found {}", self.expected, s, self.found)