let assign_expr = ctx.find_node_at_offset::<ast::BinExpr>()?;
let op_kind = assign_expr.op_kind()?;
- if op_kind != ast::BinOp::Assignment {
+ if op_kind != (ast::BinaryOp::Assignment { op: None }) {
cov_mark::hit!(test_cant_pull_non_assignments);
return None;
}
}
}
fn collect_block(&mut self, block: &ast::BlockExpr) -> Option<()> {
- let last_expr = block.tail_expr().or_else(|| {
- if let ast::Stmt::ExprStmt(stmt) = block.statements().last()? {
- stmt.expr()
- } else {
- None
- }
+ let last_expr = block.tail_expr().or_else(|| match block.statements().last()? {
+ ast::Stmt::ExprStmt(stmt) => stmt.expr(),
+ ast::Stmt::Item(_) | ast::Stmt::LetStmt(_) => None,
})?;
if let ast::Expr::BinExpr(expr) = last_expr {
}
fn collect_expr(&mut self, expr: &ast::BinExpr) -> Option<()> {
- if expr.op_kind()? == ast::BinOp::Assignment
+ if expr.op_kind()? == (ast::BinaryOp::Assignment { op: None })
&& is_equivalent(self.sema, &expr.lhs()?, &self.common_lhs)
{
self.assignments.push((expr.clone(), expr.rhs()?));