@@ -36,6 +36,9 @@ pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut Diag
3636 validator. validate_body ( db) ;
3737}
3838
39+ // Diagnostic: no-such-field
40+ //
41+ // This diagnostic is triggered if created structure does not have field provided in record.
3942#[ derive( Debug ) ]
4043pub struct NoSuchField {
4144 pub file : HirFileId ,
@@ -60,6 +63,17 @@ impl Diagnostic for NoSuchField {
6063 }
6164}
6265
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+ // ```
6377#[ derive( Debug ) ]
6478pub struct MissingFields {
6579 pub file : HirFileId ,
@@ -96,6 +110,21 @@ impl Diagnostic for MissingFields {
96110 }
97111}
98112
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+ // ```
99128#[ derive( Debug ) ]
100129pub struct MissingPatFields {
101130 pub file : HirFileId ,
@@ -130,6 +159,9 @@ impl Diagnostic for MissingPatFields {
130159 }
131160}
132161
162+ // Diagnostic: missing-match-arm
163+ //
164+ // This diagnostic is triggered if `match` block is missing one or more match arms.
133165#[ derive( Debug ) ]
134166pub struct MissingMatchArms {
135167 pub file : HirFileId ,
@@ -152,6 +184,17 @@ impl Diagnostic for MissingMatchArms {
152184 }
153185}
154186
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+ // ```
155198#[ derive( Debug ) ]
156199pub struct MissingOkInTailExpr {
157200 pub file : HirFileId ,
@@ -173,6 +216,9 @@ impl Diagnostic for MissingOkInTailExpr {
173216 }
174217}
175218
219+ // Diagnostic: break-outside-of-loop
220+ //
221+ // This diagnostic is triggered if `break` keyword is used outside of a loop.
176222#[ derive( Debug ) ]
177223pub struct BreakOutsideOfLoop {
178224 pub file : HirFileId ,
@@ -194,6 +240,9 @@ impl Diagnostic for BreakOutsideOfLoop {
194240 }
195241}
196242
243+ // Diagnostic: missing-unsafe
244+ //
245+ // This diagnostic is triggered if operation marked as `unsafe` is used outside of `unsafe` function or block.
197246#[ derive( Debug ) ]
198247pub struct MissingUnsafe {
199248 pub file : HirFileId ,
@@ -215,6 +264,9 @@ impl Diagnostic for MissingUnsafe {
215264 }
216265}
217266
267+ // Diagnostic: mismatched-arg-count
268+ //
269+ // This diagnostic is triggered if function is invoked with an incorrect amount of arguments.
218270#[ derive( Debug ) ]
219271pub struct MismatchedArgCount {
220272 pub file : HirFileId ,
@@ -264,6 +316,9 @@ impl fmt::Display for CaseType {
264316 }
265317}
266318
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].
267322#[ derive( Debug ) ]
268323pub struct IncorrectCase {
269324 pub file : HirFileId ,
0 commit comments