@@ -279,7 +279,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
279
279
pub fn extract_inference_diagnostics_data (
280
280
& self ,
281
281
arg : GenericArg < ' tcx > ,
282
- highlight : Option < ty:: print:: RegionHighlightMode < ' tcx > > ,
282
+ highlight : ty:: print:: RegionHighlightMode < ' tcx > ,
283
283
) -> InferenceDiagnosticsData {
284
284
match arg. unpack ( ) {
285
285
GenericArgKind :: Type ( ty) => {
@@ -301,9 +301,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
301
301
}
302
302
303
303
let mut printer = ty:: print:: FmtPrinter :: new ( self . tcx , Namespace :: TypeNS ) ;
304
- if let Some ( highlight) = highlight {
305
- printer. region_highlight_mode = highlight;
306
- }
304
+ printer. region_highlight_mode = highlight;
305
+
307
306
ty. print ( & mut printer) . unwrap ( ) ;
308
307
InferenceDiagnosticsData {
309
308
name : printer. into_buffer ( ) ,
@@ -326,9 +325,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
326
325
327
326
debug_assert ! ( !origin. span. is_dummy( ) ) ;
328
327
let mut printer = ty:: print:: FmtPrinter :: new ( self . tcx , Namespace :: ValueNS ) ;
329
- if let Some ( highlight) = highlight {
330
- printer. region_highlight_mode = highlight;
331
- }
328
+ printer. region_highlight_mode = highlight;
329
+
332
330
ct. print ( & mut printer) . unwrap ( ) ;
333
331
InferenceDiagnosticsData {
334
332
name : printer. into_buffer ( ) ,
@@ -344,9 +342,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
344
342
// to figure out which inference var is actually unresolved so that
345
343
// this path is unreachable.
346
344
let mut printer = ty:: print:: FmtPrinter :: new ( self . tcx , Namespace :: ValueNS ) ;
347
- if let Some ( highlight) = highlight {
348
- printer. region_highlight_mode = highlight;
349
- }
345
+ printer. region_highlight_mode = highlight;
346
+
350
347
ct. print ( & mut printer) . unwrap ( ) ;
351
348
InferenceDiagnosticsData {
352
349
name : printer. into_buffer ( ) ,
@@ -422,7 +419,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
422
419
should_label_span : bool ,
423
420
) -> Diag < ' a > {
424
421
let arg = self . resolve_vars_if_possible ( arg) ;
425
- let arg_data = self . extract_inference_diagnostics_data ( arg, None ) ;
422
+ let arg_data =
423
+ self . extract_inference_diagnostics_data ( arg, ty:: print:: RegionHighlightMode :: default ( ) ) ;
426
424
427
425
let Some ( typeck_results) = & self . typeck_results else {
428
426
// If we don't have any typeck results we're outside
0 commit comments