map_unit_fn: Delay macro check

This commit is contained in:
Jason Newcomb 2024-06-13 18:35:47 -04:00
parent 7a942a5c99
commit 488a545a50

View File

@ -253,14 +253,11 @@ fn lint_map_unit_fn(
impl<'tcx> LateLintPass<'tcx> for MapUnit { impl<'tcx> LateLintPass<'tcx> for MapUnit {
fn check_stmt(&mut self, cx: &LateContext<'_>, stmt: &hir::Stmt<'_>) { fn check_stmt(&mut self, cx: &LateContext<'_>, stmt: &hir::Stmt<'_>) {
if stmt.span.from_expansion() { if let hir::StmtKind::Semi(expr) = stmt.kind
return; && !stmt.span.from_expansion()
} && let Some(arglists) = method_chain_args(expr, &["map"])
{
if let hir::StmtKind::Semi(expr) = stmt.kind {
if let Some(arglists) = method_chain_args(expr, &["map"]) {
lint_map_unit_fn(cx, stmt, expr, arglists[0]); lint_map_unit_fn(cx, stmt, expr, arglists[0]);
} }
} }
}
} }