@@ -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
) ;
@@ -1754,7 +1754,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1754
1754
& import_suggestions,
1755
1755
Instead :: Yes ,
1756
1756
FoundUse :: Yes ,
1757
- DiagnosticMode :: Import ,
1757
+ DiagMode :: Import ,
1758
1758
vec ! [ ] ,
1759
1759
"" ,
1760
1760
) ;
@@ -2675,7 +2675,7 @@ enum FoundUse {
2675
2675
}
2676
2676
2677
2677
/// Whether a binding is part of a pattern or a use statement. Used for diagnostics.
2678
- pub ( crate ) enum DiagnosticMode {
2678
+ pub ( crate ) enum DiagMode {
2679
2679
Normal ,
2680
2680
/// The binding is part of a pattern
2681
2681
Pattern ,
@@ -2689,7 +2689,7 @@ pub(crate) fn import_candidates(
2689
2689
// This is `None` if all placement locations are inside expansions
2690
2690
use_placement_span : Option < Span > ,
2691
2691
candidates : & [ ImportSuggestion ] ,
2692
- mode : DiagnosticMode ,
2692
+ mode : DiagMode ,
2693
2693
append : & str ,
2694
2694
) {
2695
2695
show_candidates (
@@ -2717,7 +2717,7 @@ fn show_candidates(
2717
2717
candidates : & [ ImportSuggestion ] ,
2718
2718
instead : Instead ,
2719
2719
found_use : FoundUse ,
2720
- mode : DiagnosticMode ,
2720
+ mode : DiagMode ,
2721
2721
path : Vec < Segment > ,
2722
2722
append : & str ,
2723
2723
) -> bool {
@@ -2778,7 +2778,7 @@ fn show_candidates(
2778
2778
} ;
2779
2779
2780
2780
let instead = if let Instead :: Yes = instead { " instead" } else { "" } ;
2781
- let mut msg = if let DiagnosticMode :: Pattern = mode {
2781
+ let mut msg = if let DiagMode :: Pattern = mode {
2782
2782
format ! (
2783
2783
"if you meant to match on {kind}{instead}{name}, use the full path in the pattern" ,
2784
2784
)
@@ -2792,7 +2792,7 @@ fn show_candidates(
2792
2792
2793
2793
if let Some ( span) = use_placement_span {
2794
2794
let ( add_use, trailing) = match mode {
2795
- DiagnosticMode :: Pattern => {
2795
+ DiagMode :: Pattern => {
2796
2796
err. span_suggestions (
2797
2797
span,
2798
2798
msg,
@@ -2801,14 +2801,14 @@ fn show_candidates(
2801
2801
) ;
2802
2802
return true ;
2803
2803
}
2804
- DiagnosticMode :: Import => ( "" , "" ) ,
2805
- DiagnosticMode :: Normal => ( "use " , ";\n " ) ,
2804
+ DiagMode :: Import => ( "" , "" ) ,
2805
+ DiagMode :: Normal => ( "use " , ";\n " ) ,
2806
2806
} ;
2807
2807
for candidate in & mut accessible_path_strings {
2808
2808
// produce an additional newline to separate the new use statement
2809
2809
// from the directly following item.
2810
2810
let additional_newline = if let FoundUse :: No = found_use
2811
- && let DiagnosticMode :: Normal = mode
2811
+ && let DiagMode :: Normal = mode
2812
2812
{
2813
2813
"\n "
2814
2814
} else {
@@ -2849,16 +2849,13 @@ fn show_candidates(
2849
2849
err. help ( msg) ;
2850
2850
}
2851
2851
true
2852
- } else if !( inaccessible_path_strings. is_empty ( ) || matches ! ( mode, DiagnosticMode :: Import ) ) {
2853
- let prefix = if let DiagnosticMode :: Pattern = mode {
2854
- "you might have meant to match on "
2855
- } else {
2856
- ""
2857
- } ;
2852
+ } else if !( inaccessible_path_strings. is_empty ( ) || matches ! ( mode, DiagMode :: Import ) ) {
2853
+ let prefix =
2854
+ if let DiagMode :: Pattern = mode { "you might have meant to match on " } else { "" } ;
2858
2855
if let [ ( name, descr, def_id, note, _) ] = & inaccessible_path_strings[ ..] {
2859
2856
let msg = format ! (
2860
2857
"{prefix}{descr} `{name}`{} exists but is inaccessible" ,
2861
- if let DiagnosticMode :: Pattern = mode { ", which" } else { "" }
2858
+ if let DiagMode :: Pattern = mode { ", which" } else { "" }
2862
2859
) ;
2863
2860
2864
2861
if let Some ( local_def_id) = def_id. and_then ( |did| did. as_local ( ) ) {
0 commit comments