From bb7ea9d7a4758eabc84494a73bee3e6289d5bc0e Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 12 Jul 2024 04:38:33 +1200 Subject: [PATCH] `cargo fmt` --- .../src/simplify/expr/tests.rs | 4 ++-- crates/swc_ecma_utils/src/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs b/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs index 6f6d7b4d89a2..ba3ad6f30150 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs @@ -494,14 +494,14 @@ fn test_unary_ops_5() { fold("+[]", "0"); fold("+[[]]", "0"); fold("+[[[]]]", "0"); - + // Arrays with one element fold("+[1]", "1"); fold("+[[1]]", "1"); fold("+[undefined]", "0"); fold("+[null]", "0"); fold("+[,]", "0"); - + // Arrays with more than one element fold("+[1, 2]", "NaN"); fold("+[[1], 2]", "NaN"); diff --git a/crates/swc_ecma_utils/src/lib.rs b/crates/swc_ecma_utils/src/lib.rs index 7316fb3aab62..c50cd8ee278b 100644 --- a/crates/swc_ecma_utils/src/lib.rs +++ b/crates/swc_ecma_utils/src/lib.rs @@ -894,9 +894,9 @@ pub trait ExprExt { let Known(s) = self.as_pure_string(ctx) else { return (Pure, Unknown); }; - + return (Pure, num_from_str(&s)); - }, + } Expr::Ident(Ident { sym, span, .. }) => match &**sym { "undefined" | "NaN" if span.ctxt == ctx.unresolved_ctxt => f64::NAN, "Infinity" if span.ctxt == ctx.unresolved_ctxt => f64::INFINITY,