@@ -970,7 +970,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
970
970
self . field_ty ( span, f, substs)
971
971
} )
972
972
. unwrap_or_else ( || {
973
- inexistent_fields. push ( ( span , field. ident ) ) ;
973
+ inexistent_fields. push ( field. ident ) ;
974
974
no_field_errors = false ;
975
975
tcx. types . err
976
976
} )
@@ -986,24 +986,24 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
986
986
. collect :: < Vec < _ > > ( ) ;
987
987
if inexistent_fields. len ( ) > 0 && !variant. recovered {
988
988
let ( field_names, t, plural) = if inexistent_fields. len ( ) == 1 {
989
- ( format ! ( "a field named `{}`" , inexistent_fields[ 0 ] . 1 ) , "this" , "" )
989
+ ( format ! ( "a field named `{}`" , inexistent_fields[ 0 ] ) , "this" , "" )
990
990
} else {
991
991
( format ! ( "fields named {}" ,
992
992
inexistent_fields. iter( )
993
- . map( |( _ , name ) | format!( "`{}`" , name ) )
993
+ . map( |ident | format!( "`{}`" , ident ) )
994
994
. collect:: <Vec <String >>( )
995
995
. join( ", " ) ) , "these" , "s" )
996
996
} ;
997
- let spans = inexistent_fields. iter ( ) . map ( |( span , _ ) | * span) . collect :: < Vec < _ > > ( ) ;
997
+ let spans = inexistent_fields. iter ( ) . map ( |ident| ident . span ) . collect :: < Vec < _ > > ( ) ;
998
998
let mut err = struct_span_err ! ( tcx. sess,
999
999
spans,
1000
1000
E0026 ,
1001
1001
"{} `{}` does not have {}" ,
1002
1002
kind_name,
1003
1003
tcx. def_path_str( variant. def_id) ,
1004
1004
field_names) ;
1005
- if let Some ( ( span , ident) ) = inexistent_fields. last ( ) {
1006
- err. span_label ( * span,
1005
+ if let Some ( ident) = inexistent_fields. last ( ) {
1006
+ err. span_label ( ident . span ,
1007
1007
format ! ( "{} `{}` does not have {} field{}" ,
1008
1008
kind_name,
1009
1009
tcx. def_path_str( variant. def_id) ,
@@ -1015,8 +1015,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
1015
1015
find_best_match_for_name ( input, & ident. as_str ( ) , None ) ;
1016
1016
if let Some ( suggested_name) = suggested_name {
1017
1017
err. span_suggestion (
1018
- * span,
1019
- "did you mean " ,
1018
+ ident . span ,
1019
+ "a field with a similar name exists " ,
1020
1020
suggested_name. to_string ( ) ,
1021
1021
Applicability :: MaybeIncorrect ,
1022
1022
) ;
0 commit comments