Skip to content

Commit

Permalink
refactor(linter/oxc): improve code comment for `no-accumulating-sprea…
Browse files Browse the repository at this point in the history
…d` (#5373)

mentioned here: #5302 (comment)
it's not exactly clear why we check that it's a `let` declaration kind.
  • Loading branch information
camc314 committed Aug 31, 2024
1 parent db55444 commit 024b585
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/oxc/no_accumulating_spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 024b585

Please sign in to comment.