@@ -185,7 +185,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
185
185
& candidates,
186
186
if instead { Instead :: Yes } else { Instead :: No } ,
187
187
found_use,
188
- DiagnosticMode :: Normal ,
188
+ DiagMode :: Normal ,
189
189
path,
190
190
"" ,
191
191
) ;
@@ -720,7 +720,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
720
720
& import_suggestions,
721
721
Instead :: No ,
722
722
FoundUse :: Yes ,
723
- DiagnosticMode :: Pattern ,
723
+ DiagMode :: Pattern ,
724
724
vec ! [ ] ,
725
725
"" ,
726
726
) ;
@@ -1441,7 +1441,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1441
1441
& import_suggestions,
1442
1442
Instead :: No ,
1443
1443
found_use,
1444
- DiagnosticMode :: Normal ,
1444
+ DiagMode :: Normal ,
1445
1445
vec ! [ ] ,
1446
1446
"" ,
1447
1447
) ;
@@ -1753,7 +1753,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1753
1753
& import_suggestions,
1754
1754
Instead :: Yes ,
1755
1755
FoundUse :: Yes ,
1756
- DiagnosticMode :: Import ,
1756
+ DiagMode :: Import ,
1757
1757
vec ! [ ] ,
1758
1758
"" ,
1759
1759
) ;
@@ -2674,7 +2674,7 @@ enum FoundUse {
2674
2674
}
2675
2675
2676
2676
/// 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 {
2678
2678
Normal ,
2679
2679
/// The binding is part of a pattern
2680
2680
Pattern ,
@@ -2688,7 +2688,7 @@ pub(crate) fn import_candidates(
2688
2688
// This is `None` if all placement locations are inside expansions
2689
2689
use_placement_span : Option < Span > ,
2690
2690
candidates : & [ ImportSuggestion ] ,
2691
- mode : DiagnosticMode ,
2691
+ mode : DiagMode ,
2692
2692
append : & str ,
2693
2693
) {
2694
2694
show_candidates (
@@ -2716,7 +2716,7 @@ fn show_candidates(
2716
2716
candidates : & [ ImportSuggestion ] ,
2717
2717
instead : Instead ,
2718
2718
found_use : FoundUse ,
2719
- mode : DiagnosticMode ,
2719
+ mode : DiagMode ,
2720
2720
path : Vec < Segment > ,
2721
2721
append : & str ,
2722
2722
) -> bool {
@@ -2777,7 +2777,7 @@ fn show_candidates(
2777
2777
} ;
2778
2778
2779
2779
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 {
2781
2781
format ! (
2782
2782
"if you meant to match on {kind}{instead}{name}, use the full path in the pattern" ,
2783
2783
)
@@ -2791,7 +2791,7 @@ fn show_candidates(
2791
2791
2792
2792
if let Some ( span) = use_placement_span {
2793
2793
let ( add_use, trailing) = match mode {
2794
- DiagnosticMode :: Pattern => {
2794
+ DiagMode :: Pattern => {
2795
2795
err. span_suggestions (
2796
2796
span,
2797
2797
msg,
@@ -2800,14 +2800,14 @@ fn show_candidates(
2800
2800
) ;
2801
2801
return true ;
2802
2802
}
2803
- DiagnosticMode :: Import => ( "" , "" ) ,
2804
- DiagnosticMode :: Normal => ( "use " , ";\n " ) ,
2803
+ DiagMode :: Import => ( "" , "" ) ,
2804
+ DiagMode :: Normal => ( "use " , ";\n " ) ,
2805
2805
} ;
2806
2806
for candidate in & mut accessible_path_strings {
2807
2807
// produce an additional newline to separate the new use statement
2808
2808
// from the directly following item.
2809
2809
let additional_newline = if let FoundUse :: No = found_use
2810
- && let DiagnosticMode :: Normal = mode
2810
+ && let DiagMode :: Normal = mode
2811
2811
{
2812
2812
"\n "
2813
2813
} else {
@@ -2848,16 +2848,13 @@ fn show_candidates(
2848
2848
err. help ( msg) ;
2849
2849
}
2850
2850
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 { "" } ;
2857
2854
if let [ ( name, descr, def_id, note, _) ] = & inaccessible_path_strings[ ..] {
2858
2855
let msg = format ! (
2859
2856
"{prefix}{descr} `{name}`{} exists but is inaccessible" ,
2860
- if let DiagnosticMode :: Pattern = mode { ", which" } else { "" }
2857
+ if let DiagMode :: Pattern = mode { ", which" } else { "" }
2861
2858
) ;
2862
2859
2863
2860
if let Some ( local_def_id) = def_id. and_then ( |did| did. as_local ( ) ) {
0 commit comments