diff --git a/Cargo.toml b/Cargo.toml index d51528cddcbcb..0ad5d75411ec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/crates/oxc_transformer/src/es2022/class_properties/constructor.rs b/crates/oxc_transformer/src/es2022/class_properties/constructor.rs index e1e9abc698f18..0b67f0c761dda 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/constructor.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/constructor.rs @@ -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}; @@ -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));