File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -297,18 +297,16 @@ impl Session {
297
297
/// deduplicates on span and message for this `Session`.
298
298
//
299
299
// FIXME: if the need arises for one-time diagnostics other than
300
- // `span_note`, we almost certainly want to generalize this "check the
301
- // one-time diagnostics map, then set message if it's not already there"
302
- // code to accomodate all of them
300
+ // `span_note`, we almost certainly want to generalize this
301
+ // "check/insert-into the one-time diagnostics map, then set message if
302
+ // it's not already there" code to accomodate all of them
303
303
pub fn diag_span_note_once < ' a , ' b > ( & ' a self ,
304
304
diag_builder : & ' b mut DiagnosticBuilder < ' a > ,
305
305
span : Span , message : & str ) {
306
306
let span_message = ( span, message. to_owned ( ) ) ;
307
- let already_noted: bool = self . one_time_diagnostics . borrow ( )
308
- . contains ( & span_message) ;
309
- if !already_noted {
307
+ let fresh = self . one_time_diagnostics . borrow_mut ( ) . insert ( span_message) ;
308
+ if fresh {
310
309
diag_builder. span_note ( span, & message) ;
311
- self . one_time_diagnostics . borrow_mut ( ) . insert ( span_message) ;
312
310
}
313
311
}
314
312
You can’t perform that action at this time.
0 commit comments