Rollup merge of #102765 - TaKO8Ki:follow-up-to-102708, r=compiler-errors
Suggest `==` to the first expr which has `ExprKind::Assign` kind follow-up to #102708 [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4241dc33ed8af02e1ef530d6b14903fd)
This commit is contained in:
commit
ad45dd1722
3 changed files with 36 additions and 1 deletions
|
@ -1051,8 +1051,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
rhs_expr,
|
||||
) = lhs.kind
|
||||
{
|
||||
// if x == 1 && y == 2 { .. }
|
||||
// +
|
||||
let actual_lhs_ty = self.check_expr(&rhs_expr);
|
||||
(Applicability::MaybeIncorrect, self.can_coerce(rhs_ty, actual_lhs_ty))
|
||||
} else if let ExprKind::Binary(
|
||||
Spanned { node: hir::BinOpKind::And | hir::BinOpKind::Or, .. },
|
||||
lhs_expr,
|
||||
_,
|
||||
) = rhs.kind
|
||||
{
|
||||
// if x == 1 && y == 2 { .. }
|
||||
// +
|
||||
let actual_rhs_ty = self.check_expr(&lhs_expr);
|
||||
(Applicability::MaybeIncorrect, self.can_coerce(actual_rhs_ty, lhs_ty))
|
||||
} else {
|
||||
(Applicability::MaybeIncorrect, false)
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue