misc: use Ty::is_unit

This commit is contained in:
Ada Alakbarova 2025-08-12 19:36:03 +02:00
parent af2dd2d3bc
commit 8725fac6f3
No known key found for this signature in database

View file

@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessarySemicolon {
expr.kind,
ExprKind::If(..) | ExprKind::Match(_, _, MatchSource::Normal | MatchSource::Postfix)
)
&& cx.typeck_results().expr_ty(expr) == cx.tcx.types.unit
&& cx.typeck_results().expr_ty(expr).is_unit()
// if a stmt has attrs, then turning it into an expr will break the code, since attrs aren't allowed on exprs
&& cx.tcx.hir_attrs(stmt.hir_id).is_empty()
{