@@ -188,7 +188,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
188
188
& candidates,
189
189
if instead { Instead :: Yes } else { Instead :: No } ,
190
190
found_use,
191
- DiagnosticMode :: Normal ,
191
+ DiagMode :: Normal ,
192
192
path,
193
193
"" ,
194
194
) ;
@@ -723,7 +723,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
723
723
& import_suggestions,
724
724
Instead :: No ,
725
725
FoundUse :: Yes ,
726
- DiagnosticMode :: Pattern ,
726
+ DiagMode :: Pattern ,
727
727
vec ! [ ] ,
728
728
"" ,
729
729
) ;
@@ -1444,7 +1444,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1444
1444
& import_suggestions,
1445
1445
Instead :: No ,
1446
1446
found_use,
1447
- DiagnosticMode :: Normal ,
1447
+ DiagMode :: Normal ,
1448
1448
vec ! [ ] ,
1449
1449
"" ,
1450
1450
) ;
@@ -1775,7 +1775,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1775
1775
& import_suggestions,
1776
1776
Instead :: Yes ,
1777
1777
FoundUse :: Yes ,
1778
- DiagnosticMode :: Import ,
1778
+ DiagMode :: Import ,
1779
1779
vec ! [ ] ,
1780
1780
"" ,
1781
1781
) ;
@@ -2696,7 +2696,7 @@ enum FoundUse {
2696
2696
}
2697
2697
2698
2698
/// Whether a binding is part of a pattern or a use statement. Used for diagnostics.
2699
- pub ( crate ) enum DiagnosticMode {
2699
+ pub ( crate ) enum DiagMode {
2700
2700
Normal ,
2701
2701
/// The binding is part of a pattern
2702
2702
Pattern ,
@@ -2710,7 +2710,7 @@ pub(crate) fn import_candidates(
2710
2710
// This is `None` if all placement locations are inside expansions
2711
2711
use_placement_span : Option < Span > ,
2712
2712
candidates : & [ ImportSuggestion ] ,
2713
- mode : DiagnosticMode ,
2713
+ mode : DiagMode ,
2714
2714
append : & str ,
2715
2715
) {
2716
2716
show_candidates (
@@ -2738,7 +2738,7 @@ fn show_candidates(
2738
2738
candidates : & [ ImportSuggestion ] ,
2739
2739
instead : Instead ,
2740
2740
found_use : FoundUse ,
2741
- mode : DiagnosticMode ,
2741
+ mode : DiagMode ,
2742
2742
path : Vec < Segment > ,
2743
2743
append : & str ,
2744
2744
) -> bool {
@@ -2799,7 +2799,7 @@ fn show_candidates(
2799
2799
} ;
2800
2800
2801
2801
let instead = if let Instead :: Yes = instead { " instead" } else { "" } ;
2802
- let mut msg = if let DiagnosticMode :: Pattern = mode {
2802
+ let mut msg = if let DiagMode :: Pattern = mode {
2803
2803
format ! (
2804
2804
"if you meant to match on {kind}{instead}{name}, use the full path in the pattern" ,
2805
2805
)
@@ -2813,7 +2813,7 @@ fn show_candidates(
2813
2813
2814
2814
if let Some ( span) = use_placement_span {
2815
2815
let ( add_use, trailing) = match mode {
2816
- DiagnosticMode :: Pattern => {
2816
+ DiagMode :: Pattern => {
2817
2817
err. span_suggestions (
2818
2818
span,
2819
2819
msg,
@@ -2822,14 +2822,14 @@ fn show_candidates(
2822
2822
) ;
2823
2823
return true ;
2824
2824
}
2825
- DiagnosticMode :: Import => ( "" , "" ) ,
2826
- DiagnosticMode :: Normal => ( "use " , ";\n " ) ,
2825
+ DiagMode :: Import => ( "" , "" ) ,
2826
+ DiagMode :: Normal => ( "use " , ";\n " ) ,
2827
2827
} ;
2828
2828
for candidate in & mut accessible_path_strings {
2829
2829
// produce an additional newline to separate the new use statement
2830
2830
// from the directly following item.
2831
2831
let additional_newline = if let FoundUse :: No = found_use
2832
- && let DiagnosticMode :: Normal = mode
2832
+ && let DiagMode :: Normal = mode
2833
2833
{
2834
2834
"\n "
2835
2835
} else {
@@ -2870,16 +2870,13 @@ fn show_candidates(
2870
2870
err. help ( msg) ;
2871
2871
}
2872
2872
true
2873
- } else if !( inaccessible_path_strings. is_empty ( ) || matches ! ( mode, DiagnosticMode :: Import ) ) {
2874
- let prefix = if let DiagnosticMode :: Pattern = mode {
2875
- "you might have meant to match on "
2876
- } else {
2877
- ""
2878
- } ;
2873
+ } else if !( inaccessible_path_strings. is_empty ( ) || matches ! ( mode, DiagMode :: Import ) ) {
2874
+ let prefix =
2875
+ if let DiagMode :: Pattern = mode { "you might have meant to match on " } else { "" } ;
2879
2876
if let [ ( name, descr, def_id, note, _) ] = & inaccessible_path_strings[ ..] {
2880
2877
let msg = format ! (
2881
2878
"{prefix}{descr} `{name}`{} exists but is inaccessible" ,
2882
- if let DiagnosticMode :: Pattern = mode { ", which" } else { "" }
2879
+ if let DiagMode :: Pattern = mode { ", which" } else { "" }
2883
2880
) ;
2884
2881
2885
2882
if let Some ( local_def_id) = def_id. and_then ( |did| did. as_local ( ) ) {
0 commit comments