Repository: swc-project/swc
File: crates/swc_ecma_minifier/src/compress/pure/strings.rs (Rust)

Code before:
            ($e:expr) => {
                if let Some(cooked) = $e.cooked {
                    cur_cooked_str.push_wtf8(&cooked);
                } else {
                    cur_cooked_str.push_str(Str::from_tpl_raw(&$e.raw).as_ref());
                }
                cur_raw_str.push_str(&$e.raw);
            };
        }

        macro_rules! end_str {
            () => {
                let cooked = Wtf8Atom::from(&*cur_cooked_str);
                let raw = Atom::from(&*cur_raw_str);
                cur_cooked_str.clear();
                cur_raw_str.clear();
                new_tpl.quasis.push(TplElement {
                    span: DUMMY_SP,
                    tail: false,
                    cooked: Some(cooked),
                    raw,
                });
            };
        }

        // Consume a quasis first to make sure it align with exprs
        // quasis.len() == exprs.len() + 1
        if let Some(q) = q_iter.next() {
            push_str!(q);
        }

        for (q, mut e) in zip(q_iter, e_iter) {
            self.eval_nested_tpl(&mut e);
            match *e {
                Expr::Tpl(mut tpl) => {
                    // For evaluated template only the first
                    // and the last quasis could be concat with
                    // outside quasis.
                    let mut quasis_taken = tpl.quasis.take();
                    let l = quasis_taken.len();

                    // Store the first quasis for later concat
                    let first = quasis_taken[0].take();
                    push_str!(first);

                    if l > 1 {
                        // If there are more than one quasis
                        // Concat first with outside quasis
                        end_str!();

                        // Store the last quasis for later concat

Review comment (suggestion):
Grammar issue: "quasis" should be singular "quasi" or the article "a" should be removed to make it plural ("Consume quasis first").
```suggestion
        // Consume quasis first to make sure it align with exprs
```

Code after:
            ($e:expr) => {
                if let Some(cooked) = $e.cooked {
                    cur_cooked_str.push_wtf8(&cooked);
                } else {
                    cur_cooked_str.push_str(Str::from_tpl_raw(&$e.raw).as_ref());
                }
                cur_raw_str.push_str(&$e.raw);
            };
        }

        macro_rules! end_str {
            () => {
                let cooked = Wtf8Atom::from(&*cur_cooked_str);
                let raw = Atom::from(&*cur_raw_str);
                cur_cooked_str.clear();
                cur_raw_str.clear();
                new_tpl.quasis.push(TplElement {
                    span: DUMMY_SP,
                    tail: false,
                    cooked: Some(cooked),
                    raw,
                });
            };
        }

        // Consume quasis first to make sure it align with exprs
        // quasis.len() == exprs.len() + 1
        if let Some(q) = q_iter.next() {
            push_str!(q);
        }

        for (q, mut e) in zip(q_iter, e_iter) {
            self.eval_nested_tpl(&mut e);
            match *e {
                Expr::Tpl(mut tpl) => {
                    // For evaluated template only the first
                    // and the last quasi could be concat with
                    // outside quasis.
                    let mut quasis_taken = tpl.quasis.take();
                    let l = quasis_taken.len();

                    // Store the first quasi for later concat
                    let first = quasis_taken[0].take();
                    push_str!(first);

                    if l > 1 {
                        // If there are more than one quasi
                        // Concat first with outside quasis
                        end_str!();

                        // Store the last quasi for later concat