@@ -1136,18 +1136,16 @@ impl<'a> InferenceContext<'a> {
1136
1136
if self . diverges . is_always ( ) {
1137
1137
// we don't even make an attempt at coercion
1138
1138
self . table . new_maybe_never_var ( )
1139
- } else {
1140
- if let Some ( t) = expected. only_has_type ( & mut self . table ) {
1141
- if self . coerce ( Some ( expr) , & TyBuilder :: unit ( ) , & t) . is_err ( ) {
1142
- self . result . type_mismatches . insert (
1143
- expr. into ( ) ,
1144
- TypeMismatch { expected : t. clone ( ) , actual : TyBuilder :: unit ( ) } ,
1145
- ) ;
1146
- }
1147
- t
1148
- } else {
1149
- TyBuilder :: unit ( )
1139
+ } else if let Some ( t) = expected. only_has_type ( & mut self . table ) {
1140
+ if self . coerce ( Some ( expr) , & TyBuilder :: unit ( ) , & t) . is_err ( ) {
1141
+ self . result . type_mismatches . insert (
1142
+ expr. into ( ) ,
1143
+ TypeMismatch { expected : t. clone ( ) , actual : TyBuilder :: unit ( ) } ,
1144
+ ) ;
1150
1145
}
1146
+ t
1147
+ } else {
1148
+ TyBuilder :: unit ( )
1151
1149
}
1152
1150
}
1153
1151
}
@@ -1314,13 +1312,13 @@ impl<'a> InferenceContext<'a> {
1314
1312
} else {
1315
1313
param_ty
1316
1314
} ;
1317
- if !coercion_target. is_unknown ( ) {
1318
- if self . coerce ( Some ( arg) , & ty, & coercion_target) . is_err ( ) {
1319
- self . result . type_mismatches . insert (
1320
- arg . into ( ) ,
1321
- TypeMismatch { expected : coercion_target , actual : ty . clone ( ) } ,
1322
- ) ;
1323
- }
1315
+ if !coercion_target. is_unknown ( )
1316
+ && self . coerce ( Some ( arg) , & ty, & coercion_target) . is_err ( )
1317
+ {
1318
+ self . result . type_mismatches . insert (
1319
+ arg . into ( ) ,
1320
+ TypeMismatch { expected : coercion_target , actual : ty . clone ( ) } ,
1321
+ ) ;
1324
1322
}
1325
1323
}
1326
1324
}
0 commit comments