@@ -95,7 +95,7 @@ use rustc::middle::region::CodeExtent;
95
95
use rustc:: ty:: subst:: { Kind , Subst , Substs } ;
96
96
use rustc:: traits:: { self , FulfillmentContext , ObligationCause , ObligationCauseCode } ;
97
97
use rustc:: ty:: { ParamTy , LvaluePreference , NoPreference , PreferMutLvalue } ;
98
- use rustc:: ty:: { self , Ty , TyCtxt , Visibility , TypeVariants } ;
98
+ use rustc:: ty:: { self , Ty , TyCtxt , Visibility } ;
99
99
use rustc:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow } ;
100
100
use rustc:: ty:: fold:: { BottomUpFolder , TypeFoldable } ;
101
101
use rustc:: ty:: maps:: Providers ;
@@ -4315,7 +4315,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4315
4315
}
4316
4316
( & hir:: FunctionRetTy :: DefaultReturn ( span) , _, _) => {
4317
4317
// `fn main()` must return `()`, do not suggest changing return type
4318
- err. span_label ( span, "expected () because of default return type" ) ;
4318
+ err. span_label ( span, "expected `()` because of default return type" ) ;
4319
4319
}
4320
4320
( & hir:: FunctionRetTy :: Return ( ref ty) , _, _) => {
4321
4321
// Only point to return type if the expected type is the return type, as if they
@@ -4326,19 +4326,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4326
4326
debug ! ( "suggest_missing_return_type: return type sty {:?}" , ty. sty) ;
4327
4327
debug ! ( "suggest_missing_return_type: expected type sty {:?}" , ty. sty) ;
4328
4328
if ty. sty == expected. sty {
4329
- let quote = if let TypeVariants :: TyTuple ( ref slice, _) = expected. sty {
4330
- if slice. len ( ) == 0 { // don't use backtics for ()
4331
- ""
4332
- } else {
4333
- "`"
4334
- }
4335
- } else {
4336
- "`"
4337
- } ;
4338
- err. span_label ( sp, format ! ( "expected {}{}{} because of return type" ,
4339
- quote,
4340
- expected,
4341
- quote) ) ;
4329
+ err. span_label ( sp, format ! ( "expected `{}` because of return type" ,
4330
+ expected) ) ;
4342
4331
}
4343
4332
}
4344
4333
}
0 commit comments