@@ -321,7 +321,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
321
321
let mut param_args = FxHashMap :: default ( ) ;
322
322
let mut param_expected = FxHashMap :: default ( ) ;
323
323
let mut param_found = FxHashMap :: default ( ) ;
324
- if self . can_eq ( self . param_env , ty, found) . is_ok ( ) {
324
+ if self . can_eq ( self . param_env , ty, found) {
325
325
// We only point at the first place where the found type was inferred.
326
326
for ( i, param_ty) in sig. inputs ( ) . skip_binder ( ) . iter ( ) . skip ( 1 ) . enumerate ( ) {
327
327
if def_self_ty. contains ( * param_ty) && let ty:: Param ( _) = param_ty. kind ( ) {
@@ -369,7 +369,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
369
369
for ( param, ( arg, arg_ty) ) in param_args. iter ( ) {
370
370
let Some ( expected) = param_expected. get ( param) else { continue ; } ;
371
371
let Some ( found) = param_found. get ( param) else { continue ; } ;
372
- if self . can_eq ( self . param_env , * arg_ty, * found) . is_err ( ) { continue ; }
372
+ if ! self . can_eq ( self . param_env , * arg_ty, * found) { continue ; }
373
373
self . emit_coerce_suggestions ( err, arg, * found, * expected, None , None ) ;
374
374
}
375
375
@@ -379,7 +379,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
379
379
}
380
380
if ty != prev
381
381
&& param_args. is_empty ( )
382
- && self . can_eq ( self . param_env , ty, found) . is_ok ( )
382
+ && self . can_eq ( self . param_env , ty, found)
383
383
{
384
384
// We only point at the first place where the found type was inferred.
385
385
if !segment. ident . span . overlaps ( mismatch_span) {
@@ -401,7 +401,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
401
401
}
402
402
if ty != prev
403
403
&& let Some ( span) = prev_span
404
- && self . can_eq ( self . param_env , ty, found) . is_ok ( )
404
+ && self . can_eq ( self . param_env , ty, found)
405
405
{
406
406
// We only point at the first place where the found type was inferred.
407
407
// We use the *previous* span because if the type is known *here* it means
@@ -764,7 +764,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
764
764
if let ty:: Adt ( expected_adt, substs) = expected. kind ( ) {
765
765
if let hir:: ExprKind :: Field ( base, ident) = expr. kind {
766
766
let base_ty = self . typeck_results . borrow ( ) . expr_ty ( base) ;
767
- if self . can_eq ( self . param_env , base_ty, expected) . is_ok ( )
767
+ if self . can_eq ( self . param_env , base_ty, expected)
768
768
&& let Some ( base_span) = base. span . find_ancestor_inside ( expr. span )
769
769
{
770
770
err. span_suggestion_verbose (
@@ -1357,7 +1357,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1357
1357
hir:: ExprKind :: AddrOf ( hir:: BorrowKind :: Ref , _, ref expr) ,
1358
1358
_,
1359
1359
& ty:: Ref ( _, checked, _) ,
1360
- ) if self . can_sub ( self . param_env , checked, expected) . is_ok ( ) => {
1360
+ ) if self . can_sub ( self . param_env , checked, expected) => {
1361
1361
// We have `&T`, check if what was expected was `T`. If so,
1362
1362
// we may want to suggest removing a `&`.
1363
1363
if sm. is_imported ( expr. span ) {
@@ -2003,7 +2003,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2003
2003
} ;
2004
2004
let hir:: StmtKind :: Semi ( tail_expr) = stmt. kind else { return ; } ;
2005
2005
let Some ( ty) = self . node_ty_opt ( tail_expr. hir_id ) else { return ; } ;
2006
- if self . can_eq ( self . param_env , expected_ty, ty) . is_ok ( ) {
2006
+ if self . can_eq ( self . param_env , expected_ty, ty) {
2007
2007
err. span_suggestion_short (
2008
2008
stmt. span . with_lo ( tail_expr. span . hi ( ) ) ,
2009
2009
"remove this semicolon" ,
0 commit comments