@@ -2409,13 +2409,15 @@ impl<'a> Resolver<'a> {
2409
2409
. map ( |suggestion| import_candidate_to_paths ( & suggestion) ) . collect :: < Vec < _ > > ( ) ;
2410
2410
enum_candidates. sort ( ) ;
2411
2411
for ( sp, variant_path, enum_path) in enum_candidates {
2412
- let msg = format ! ( "there is an enum variant `{}`, did you mean to use `{}`?" ,
2413
- variant_path,
2414
- enum_path) ;
2415
2412
if sp == DUMMY_SP {
2413
+ let msg = format ! ( "there is an enum variant `{}`, \
2414
+ try using `{}`?",
2415
+ variant_path,
2416
+ enum_path) ;
2416
2417
err. help ( & msg) ;
2417
2418
} else {
2418
- err. span_help ( sp, & msg) ;
2419
+ err. span_suggestion ( span, "you can try using the variant's enum" ,
2420
+ enum_path) ;
2419
2421
}
2420
2422
}
2421
2423
}
@@ -2424,18 +2426,20 @@ impl<'a> Resolver<'a> {
2424
2426
let self_is_available = this. self_value_is_available ( path[ 0 ] . ctxt , span) ;
2425
2427
match candidate {
2426
2428
AssocSuggestion :: Field => {
2427
- err. span_label ( span, format ! ( "did you mean `self.{}`?" , path_str) ) ;
2429
+ err. span_suggestion ( span, "try" ,
2430
+ format ! ( "self.{}" , path_str) ) ;
2428
2431
if !self_is_available {
2429
2432
err. span_label ( span, format ! ( "`self` value is only available in \
2430
2433
methods with `self` parameter") ) ;
2431
2434
}
2432
2435
}
2433
2436
AssocSuggestion :: MethodWithSelf if self_is_available => {
2434
- err. span_label ( span, format ! ( "did you mean `self.{}(...)`? ",
2435
- path_str) ) ;
2437
+ err. span_suggestion ( span, "try ",
2438
+ format ! ( "self.{}" , path_str) ) ;
2436
2439
}
2437
2440
AssocSuggestion :: MethodWithSelf | AssocSuggestion :: AssocItem => {
2438
- err. span_label ( span, format ! ( "did you mean `Self::{}`?" , path_str) ) ;
2441
+ err. span_suggestion ( span, "try" ,
2442
+ format ! ( "Self::{}" , path_str) ) ;
2439
2443
}
2440
2444
}
2441
2445
return err;
0 commit comments