@@ -36,6 +36,9 @@ pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut Diag
36
36
validator. validate_body ( db) ;
37
37
}
38
38
39
+ // Diagnostic: no-such-field
40
+ //
41
+ // This diagnostic is triggered if created structure does not have field provided in record.
39
42
#[ derive( Debug ) ]
40
43
pub struct NoSuchField {
41
44
pub file : HirFileId ,
@@ -60,6 +63,17 @@ impl Diagnostic for NoSuchField {
60
63
}
61
64
}
62
65
66
+ // Diagnostic: missing-structure-fields
67
+ //
68
+ // This diagnostic is triggered if record lacks some fields that exist in the corresponding structure.
69
+ //
70
+ // Example:
71
+ //
72
+ // ```rust
73
+ // struct A { a: u8, b: u8 }
74
+ //
75
+ // let a = A { a: 10 };
76
+ // ```
63
77
#[ derive( Debug ) ]
64
78
pub struct MissingFields {
65
79
pub file : HirFileId ,
@@ -96,6 +110,21 @@ impl Diagnostic for MissingFields {
96
110
}
97
111
}
98
112
113
+ // Diagnostic: missing-pat-fields
114
+ //
115
+ // This diagnostic is triggered if pattern lacks some fields that exist in the corresponding structure.
116
+ //
117
+ // Example:
118
+ //
119
+ // ```rust
120
+ // struct A { a: u8, b: u8 }
121
+ //
122
+ // let a = A { a: 10, b: 20 };
123
+ //
124
+ // if let A { a } = a {
125
+ // // ...
126
+ // }
127
+ // ```
99
128
#[ derive( Debug ) ]
100
129
pub struct MissingPatFields {
101
130
pub file : HirFileId ,
@@ -130,6 +159,9 @@ impl Diagnostic for MissingPatFields {
130
159
}
131
160
}
132
161
162
+ // Diagnostic: missing-match-arm
163
+ //
164
+ // This diagnostic is triggered if `match` block is missing one or more match arms.
133
165
#[ derive( Debug ) ]
134
166
pub struct MissingMatchArms {
135
167
pub file : HirFileId ,
@@ -152,6 +184,17 @@ impl Diagnostic for MissingMatchArms {
152
184
}
153
185
}
154
186
187
+ // Diagnostic: missing-ok-in-tail-expr
188
+ //
189
+ // This diagnostic is triggered if block that should return `Result` returns a value not wrapped in `Ok`.
190
+ //
191
+ // Example:
192
+ //
193
+ // ```rust
194
+ // fn foo() -> Result<u8, ()> {
195
+ // 10
196
+ // }
197
+ // ```
155
198
#[ derive( Debug ) ]
156
199
pub struct MissingOkInTailExpr {
157
200
pub file : HirFileId ,
@@ -173,6 +216,9 @@ impl Diagnostic for MissingOkInTailExpr {
173
216
}
174
217
}
175
218
219
+ // Diagnostic: break-outside-of-loop
220
+ //
221
+ // This diagnostic is triggered if `break` keyword is used outside of a loop.
176
222
#[ derive( Debug ) ]
177
223
pub struct BreakOutsideOfLoop {
178
224
pub file : HirFileId ,
@@ -194,6 +240,9 @@ impl Diagnostic for BreakOutsideOfLoop {
194
240
}
195
241
}
196
242
243
+ // Diagnostic: missing-unsafe
244
+ //
245
+ // This diagnostic is triggered if operation marked as `unsafe` is used outside of `unsafe` function or block.
197
246
#[ derive( Debug ) ]
198
247
pub struct MissingUnsafe {
199
248
pub file : HirFileId ,
@@ -215,6 +264,9 @@ impl Diagnostic for MissingUnsafe {
215
264
}
216
265
}
217
266
267
+ // Diagnostic: mismatched-arg-count
268
+ //
269
+ // This diagnostic is triggered if function is invoked with an incorrect amount of arguments.
218
270
#[ derive( Debug ) ]
219
271
pub struct MismatchedArgCount {
220
272
pub file : HirFileId ,
@@ -264,6 +316,9 @@ impl fmt::Display for CaseType {
264
316
}
265
317
}
266
318
319
+ // Diagnostic: incorrect-ident-case
320
+ //
321
+ // This diagnostic is triggered if item name doesn't follow https://doc.rust-lang.org/1.0.0/style/style/naming/README.html[Rust naming convention].
267
322
#[ derive( Debug ) ]
268
323
pub struct IncorrectCase {
269
324
pub file : HirFileId ,
0 commit comments