@@ -1021,17 +1021,11 @@ impl<'a> Resolver<'a> {
1021
1021
( "" , "" )
1022
1022
} ;
1023
1023
1024
- let article = if built_in. is_empty ( ) { res. article ( ) } else { "a" } ;
1025
- format ! (
1026
- "{a}{built_in} {thing}{from}" ,
1027
- a = article,
1028
- thing = res. descr( ) ,
1029
- built_in = built_in,
1030
- from = from
1031
- )
1024
+ let a = if built_in. is_empty ( ) { res. article ( ) } else { "a" } ;
1025
+ format ! ( "{a}{built_in} {thing}{from}" , thing = res. descr( ) )
1032
1026
} else {
1033
1027
let introduced = if b. is_import ( ) { "imported" } else { "defined" } ;
1034
- format ! ( "the {thing} {introduced} here" , thing = res. descr( ) , introduced = introduced )
1028
+ format ! ( "the {thing} {introduced} here" , thing = res. descr( ) )
1035
1029
}
1036
1030
}
1037
1031
@@ -1049,19 +1043,13 @@ impl<'a> Resolver<'a> {
1049
1043
ident. span,
1050
1044
E0659 ,
1051
1045
"`{ident}` is ambiguous ({why})" ,
1052
- ident = ident,
1053
1046
why = kind. descr( )
1054
1047
) ;
1055
1048
err. span_label ( ident. span , "ambiguous name" ) ;
1056
1049
1057
1050
let mut could_refer_to = |b : & NameBinding < ' _ > , misc : AmbiguityErrorMisc , also : & str | {
1058
1051
let what = self . binding_description ( b, ident, misc == AmbiguityErrorMisc :: FromPrelude ) ;
1059
- let note_msg = format ! (
1060
- "`{ident}` could{also} refer to {what}" ,
1061
- ident = ident,
1062
- also = also,
1063
- what = what
1064
- ) ;
1052
+ let note_msg = format ! ( "`{ident}` could{also} refer to {what}" ) ;
1065
1053
1066
1054
let thing = b. res ( ) . descr ( ) ;
1067
1055
let mut help_msgs = Vec :: new ( ) ;
@@ -1071,30 +1059,18 @@ impl<'a> Resolver<'a> {
1071
1059
|| kind == AmbiguityKind :: GlobVsOuter && swapped != also. is_empty ( ) )
1072
1060
{
1073
1061
help_msgs. push ( format ! (
1074
- "consider adding an explicit import of \
1075
- `{ident}` to disambiguate",
1076
- ident = ident
1062
+ "consider adding an explicit import of `{ident}` to disambiguate"
1077
1063
) )
1078
1064
}
1079
1065
if b. is_extern_crate ( ) && ident. span . rust_2018 ( ) {
1080
- help_msgs. push ( format ! (
1081
- "use `::{ident}` to refer to this {thing} unambiguously" ,
1082
- ident = ident,
1083
- thing = thing,
1084
- ) )
1066
+ help_msgs. push ( format ! ( "use `::{ident}` to refer to this {thing} unambiguously" ) )
1085
1067
}
1086
1068
if misc == AmbiguityErrorMisc :: SuggestCrate {
1087
- help_msgs. push ( format ! (
1088
- "use `crate::{ident}` to refer to this {thing} unambiguously" ,
1089
- ident = ident,
1090
- thing = thing,
1091
- ) )
1069
+ help_msgs
1070
+ . push ( format ! ( "use `crate::{ident}` to refer to this {thing} unambiguously" ) )
1092
1071
} else if misc == AmbiguityErrorMisc :: SuggestSelf {
1093
- help_msgs. push ( format ! (
1094
- "use `self::{ident}` to refer to this {thing} unambiguously" ,
1095
- ident = ident,
1096
- thing = thing,
1097
- ) )
1072
+ help_msgs
1073
+ . push ( format ! ( "use `self::{ident}` to refer to this {thing} unambiguously" ) )
1098
1074
}
1099
1075
1100
1076
err. span_note ( b. span , & note_msg) ;
@@ -1167,12 +1143,10 @@ impl<'a> Resolver<'a> {
1167
1143
} ;
1168
1144
1169
1145
let first = ptr:: eq ( binding, first_binding) ;
1170
- let descr = get_descr ( binding) ;
1171
1146
let msg = format ! (
1172
1147
"{and_refers_to}the {item} `{name}`{which} is defined here{dots}" ,
1173
1148
and_refers_to = if first { "" } else { "...and refers to " } ,
1174
- item = descr,
1175
- name = name,
1149
+ item = get_descr( binding) ,
1176
1150
which = if first { "" } else { " which" } ,
1177
1151
dots = if next_binding. is_some( ) { "..." } else { "" } ,
1178
1152
) ;
0 commit comments