From 66df08cb8531923d5ef0514f9df1e7c9da1d7f81 Mon Sep 17 00:00:00 2001 From: Jinbao1001 Date: Tue, 9 Jul 2024 18:40:36 +0800 Subject: [PATCH] fix: change fn --- crates/mako/src/visitors/optimize_define_utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/mako/src/visitors/optimize_define_utils.rs b/crates/mako/src/visitors/optimize_define_utils.rs index 78d962aff..a8bff3a8b 100644 --- a/crates/mako/src/visitors/optimize_define_utils.rs +++ b/crates/mako/src/visitors/optimize_define_utils.rs @@ -13,7 +13,7 @@ impl VisitMut for OptimizeDefineUtils { let mut no_directive_index = 0; for (index, item) in items.iter().enumerate() { if let Some(stmt) = item.as_stmt() - && is_directive_judged_by_stmt_value_and_raw(stmt.clone()) + && is_directive_judged_by_stmt_value_and_raw(stmt) { no_directive_index = index + 1 } else { @@ -155,7 +155,7 @@ fn is_obj_lit_arg(arg: Option<&ExprOrSpread>) -> bool { .unwrap_or(false) } -fn is_directive_judged_by_stmt_value_and_raw(stmt: Stmt) -> bool { +fn is_directive_judged_by_stmt_value_and_raw(stmt: &Stmt) -> bool { match stmt.as_ref() { Some(Stmt::Expr(expr)) => match &*expr.expr { Expr::Lit(Lit::Str(Str { raw: Some(raw), .. })) => {