File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -297,18 +297,16 @@ impl Session {
297297 /// deduplicates on span and message for this `Session`.
298298 //
299299 // 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
303303 pub fn diag_span_note_once < ' a , ' b > ( & ' a self ,
304304 diag_builder : & ' b mut DiagnosticBuilder < ' a > ,
305305 span : Span , message : & str ) {
306306 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 {
310309 diag_builder. span_note ( span, & message) ;
311- self . one_time_diagnostics . borrow_mut ( ) . insert ( span_message) ;
312310 }
313311 }
314312
You can’t perform that action at this time.
0 commit comments