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