@@ -185,7 +185,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
185185 & candidates,
186186 if instead { Instead :: Yes } else { Instead :: No } ,
187187 found_use,
188- DiagnosticMode :: Normal ,
188+ DiagMode :: Normal ,
189189 path,
190190 "" ,
191191 ) ;
@@ -720,7 +720,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
720720 & import_suggestions,
721721 Instead :: No ,
722722 FoundUse :: Yes ,
723- DiagnosticMode :: Pattern ,
723+ DiagMode :: Pattern ,
724724 vec ! [ ] ,
725725 "" ,
726726 ) ;
@@ -1441,7 +1441,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
14411441 & import_suggestions,
14421442 Instead :: No ,
14431443 found_use,
1444- DiagnosticMode :: Normal ,
1444+ DiagMode :: Normal ,
14451445 vec ! [ ] ,
14461446 "" ,
14471447 ) ;
@@ -1753,7 +1753,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
17531753 & import_suggestions,
17541754 Instead :: Yes ,
17551755 FoundUse :: Yes ,
1756- DiagnosticMode :: Import ,
1756+ DiagMode :: Import ,
17571757 vec ! [ ] ,
17581758 "" ,
17591759 ) ;
@@ -2674,7 +2674,7 @@ enum FoundUse {
26742674}
26752675
26762676/// Whether a binding is part of a pattern or a use statement. Used for diagnostics.
2677- pub ( crate ) enum DiagnosticMode {
2677+ pub ( crate ) enum DiagMode {
26782678 Normal ,
26792679 /// The binding is part of a pattern
26802680 Pattern ,
@@ -2688,7 +2688,7 @@ pub(crate) fn import_candidates(
26882688 // This is `None` if all placement locations are inside expansions
26892689 use_placement_span : Option < Span > ,
26902690 candidates : & [ ImportSuggestion ] ,
2691- mode : DiagnosticMode ,
2691+ mode : DiagMode ,
26922692 append : & str ,
26932693) {
26942694 show_candidates (
@@ -2716,7 +2716,7 @@ fn show_candidates(
27162716 candidates : & [ ImportSuggestion ] ,
27172717 instead : Instead ,
27182718 found_use : FoundUse ,
2719- mode : DiagnosticMode ,
2719+ mode : DiagMode ,
27202720 path : Vec < Segment > ,
27212721 append : & str ,
27222722) -> bool {
@@ -2777,7 +2777,7 @@ fn show_candidates(
27772777 } ;
27782778
27792779 let instead = if let Instead :: Yes = instead { " instead" } else { "" } ;
2780- let mut msg = if let DiagnosticMode :: Pattern = mode {
2780+ let mut msg = if let DiagMode :: Pattern = mode {
27812781 format ! (
27822782 "if you meant to match on {kind}{instead}{name}, use the full path in the pattern" ,
27832783 )
@@ -2791,7 +2791,7 @@ fn show_candidates(
27912791
27922792 if let Some ( span) = use_placement_span {
27932793 let ( add_use, trailing) = match mode {
2794- DiagnosticMode :: Pattern => {
2794+ DiagMode :: Pattern => {
27952795 err. span_suggestions (
27962796 span,
27972797 msg,
@@ -2800,14 +2800,14 @@ fn show_candidates(
28002800 ) ;
28012801 return true ;
28022802 }
2803- DiagnosticMode :: Import => ( "" , "" ) ,
2804- DiagnosticMode :: Normal => ( "use " , ";\n " ) ,
2803+ DiagMode :: Import => ( "" , "" ) ,
2804+ DiagMode :: Normal => ( "use " , ";\n " ) ,
28052805 } ;
28062806 for candidate in & mut accessible_path_strings {
28072807 // produce an additional newline to separate the new use statement
28082808 // from the directly following item.
28092809 let additional_newline = if let FoundUse :: No = found_use
2810- && let DiagnosticMode :: Normal = mode
2810+ && let DiagMode :: Normal = mode
28112811 {
28122812 "\n "
28132813 } else {
@@ -2848,16 +2848,13 @@ fn show_candidates(
28482848 err. help ( msg) ;
28492849 }
28502850 true
2851- } else if !( inaccessible_path_strings. is_empty ( ) || matches ! ( mode, DiagnosticMode :: Import ) ) {
2852- let prefix = if let DiagnosticMode :: Pattern = mode {
2853- "you might have meant to match on "
2854- } else {
2855- ""
2856- } ;
2851+ } else if !( inaccessible_path_strings. is_empty ( ) || matches ! ( mode, DiagMode :: Import ) ) {
2852+ let prefix =
2853+ if let DiagMode :: Pattern = mode { "you might have meant to match on " } else { "" } ;
28572854 if let [ ( name, descr, def_id, note, _) ] = & inaccessible_path_strings[ ..] {
28582855 let msg = format ! (
28592856 "{prefix}{descr} `{name}`{} exists but is inaccessible" ,
2860- if let DiagnosticMode :: Pattern = mode { ", which" } else { "" }
2857+ if let DiagMode :: Pattern = mode { ", which" } else { "" }
28612858 ) ;
28622859
28632860 if let Some ( local_def_id) = def_id. and_then ( |did| did. as_local ( ) ) {
0 commit comments