refactor(linter/oxc): improve code comment for no-accumulating-spread (#5373)

mentioned here: https://github.com/oxc-project/oxc/pull/5302#discussion_r1735759462
it's not exactly clear why we check that it's a `let` declaration kind.
This commit is contained in:
camc314 2024-08-31 20:52:04 +00:00
parent db554447aa
commit 024b58506e

View file

@ -185,7 +185,8 @@ fn check_loop_usage<'a>(
let AstKind::VariableDeclaration(declaration) = declaration_node.kind() else {
return;
};
// if the accumulator's declaration is not a `let`, then we know it's never
// reassigned, hence cannot be a violation of the rule
if !matches!(declaration.kind, VariableDeclarationKind::Let) {
return;
}