Skip to content

Commit

Permalink
fix(transformer): fix clippy::iter_on_single_items warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Feb 19, 2025
1 parent f79ea71 commit f04aa69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ doc_markdown = "allow"
# This rule also confuses newcomers and forces them to add `const` blindlessly without any reason.
missing_const_for_fn = "allow"
significant_drop_in_scrutinee = "warn"
iter_on_single_items = "warn"
# cargo
cargo = { level = "warn", priority = -1 }
multiple_crate_versions = "allow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
//! ESBuild does not handle `super()` in constructor params correctly:
//! [ESBuild REPL](https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXMyMDIwAGNsYXNzIEMgZXh0ZW5kcyBTIHsKICBwcm9wID0gZm9vKCk7CiAgY29uc3RydWN0b3IoeCA9IHN1cGVyKCksIHkgPSBzdXBlcigpKSB7fQp9Cg)
use std::iter;

use rustc_hash::FxHashMap;

use oxc_ast::{ast::*, visit::walk_mut, VisitMut, NONE};
Expand Down Expand Up @@ -316,7 +318,7 @@ impl<'a> ClassProperties<'a, '_> {
let this_expr = ctx.ast.expression_this(SPAN);
let body_exprs = ctx.ast.expression_sequence(
SPAN,
ctx.ast.vec_from_iter([super_call].into_iter().chain(inits).chain([this_expr])),
ctx.ast.vec_from_iter(iter::once(super_call).chain(inits).chain(iter::once(this_expr))),
);
let body = ctx.ast.vec1(ctx.ast.statement_expression(SPAN, body_exprs));

Expand Down

0 comments on commit f04aa69

Please sign in to comment.