@@ -90,6 +90,7 @@ impl<FileId> Label<FileId> {
9090    } 
9191
9292    /// Add a message to the diagnostic. 
93+ #[ must_use]  
9394    pub  fn  with_message ( mut  self ,  message :  impl  Display )  -> Label < FileId >  { 
9495        self . message  = message. to_string ( ) ; 
9596        self 
@@ -137,63 +138,73 @@ impl<FileId> Diagnostic<FileId> {
137138    /// Create a new diagnostic with a severity of [`Severity::Bug`]. 
138139/// 
139140/// [`Severity::Bug`]: Severity::Bug 
141+ #[ must_use]  
140142    pub  fn  bug ( )  -> Diagnostic < FileId >  { 
141143        Diagnostic :: new ( Severity :: Bug ) 
142144    } 
143145
144146    /// Create a new diagnostic with a severity of [`Severity::Error`]. 
145147/// 
146148/// [`Severity::Error`]: Severity::Error 
149+ #[ must_use]  
147150    pub  fn  error ( )  -> Diagnostic < FileId >  { 
148151        Diagnostic :: new ( Severity :: Error ) 
149152    } 
150153
151154    /// Create a new diagnostic with a severity of [`Severity::Warning`]. 
152155/// 
153156/// [`Severity::Warning`]: Severity::Warning 
157+ #[ must_use]  
154158    pub  fn  warning ( )  -> Diagnostic < FileId >  { 
155159        Diagnostic :: new ( Severity :: Warning ) 
156160    } 
157161
158162    /// Create a new diagnostic with a severity of [`Severity::Note`]. 
159163/// 
160164/// [`Severity::Note`]: Severity::Note 
165+ #[ must_use]  
161166    pub  fn  note ( )  -> Diagnostic < FileId >  { 
162167        Diagnostic :: new ( Severity :: Note ) 
163168    } 
164169
165170    /// Create a new diagnostic with a severity of [`Severity::Help`]. 
166171/// 
167172/// [`Severity::Help`]: Severity::Help 
173+ #[ must_use]  
168174    pub  fn  help ( )  -> Diagnostic < FileId >  { 
169175        Diagnostic :: new ( Severity :: Help ) 
170176    } 
171177
172178    /// Set the error code of the diagnostic. 
179+ #[ must_use]  
173180    pub  fn  with_code ( mut  self ,  code :  impl  Display )  -> Diagnostic < FileId >  { 
174181        self . code  = Some ( code. to_string ( ) ) ; 
175182        self 
176183    } 
177184
178185    /// Set the message of the diagnostic. 
186+ #[ must_use]  
179187    pub  fn  with_message ( mut  self ,  message :  impl  Display )  -> Diagnostic < FileId >  { 
180188        self . message  = message. to_string ( ) ; 
181189        self 
182190    } 
183191
184192    /// Add a label to the diagnostic. 
193+ #[ must_use]  
185194    pub  fn  with_label ( mut  self ,  label :  Label < FileId > )  -> Diagnostic < FileId >  { 
186195        self . labels . push ( label) ; 
187196        self 
188197    } 
189198
190199    /// Add some labels to the diagnostic. 
200+ #[ must_use]  
191201    pub  fn  with_labels ( mut  self ,  mut  labels :  Vec < Label < FileId > > )  -> Diagnostic < FileId >  { 
192202        self . labels . append ( & mut  labels) ; 
193203        self 
194204    } 
195205
196206    /// Add some labels to the diagnostic. 
207+ #[ must_use]  
197208    pub  fn  with_labels_iter ( 
198209        mut  self , 
199210        labels :  impl  IntoIterator < Item  = Label < FileId > > , 
@@ -204,18 +215,21 @@ impl<FileId> Diagnostic<FileId> {
204215
205216    /// Add a note to the diagnostic. 
206217#[ allow( clippy:: needless_pass_by_value) ]  
218+     #[ must_use]  
207219    pub  fn  with_note ( mut  self ,  note :  impl  ToString )  -> Diagnostic < FileId >  { 
208220        self . notes . push ( note. to_string ( ) ) ; 
209221        self 
210222    } 
211223
212224    /// Add some notes to the diagnostic. 
225+ #[ must_use]  
213226    pub  fn  with_notes ( mut  self ,  mut  notes :  Vec < String > )  -> Diagnostic < FileId >  { 
214227        self . notes . append ( & mut  notes) ; 
215228        self 
216229    } 
217230
218231    /// Add some notes to the diagnostic. 
232+ #[ must_use]  
219233    pub  fn  with_notes_iter ( 
220234        mut  self , 
221235        notes :  impl  IntoIterator < Item  = String > , 
0 commit comments