Move the new check to the end of checks

This commit is contained in:
Chris Wu 2024-01-19 21:05:58 +08:00 committed by GitHub
parent 9661f9b177
commit 73d7ce6abf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,13 +144,13 @@ fn check_no_effect(cx: &LateContext<'_>, stmt: &Stmt<'_>) -> bool {
}
} else if let StmtKind::Local(local) = stmt.kind {
if !is_lint_allowed(cx, NO_EFFECT_UNDERSCORE_BINDING, local.hir_id)
&& !any_parent_is_automatically_derived(cx.tcx, local.hir_id)
&& let Some(init) = local.init
&& local.els.is_none()
&& !local.pat.span.from_expansion()
&& has_no_effect(cx, init)
&& let PatKind::Binding(_, _, ident, _) = local.pat.kind
&& ident.name.to_ident_string().starts_with('_')
&& !any_parent_is_automatically_derived(cx.tcx, local.hir_id)
{
span_lint_hir(
cx,