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

Code before:
        // 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
                        let last = quasis_taken.pop().unwrap();
                        push_str!(last);

                        // Append the rest of quasis and exprs to new_tpl
                        new_tpl.quasis.extend(quasis_taken.into_iter().skip(1));
                        new_tpl.exprs.extend(tpl.exprs.into_iter());
                    }
                }
                _ => {
                    end_str!();

                    new_tpl.exprs.push(e);
                }
            }
            push_str!(q);
        }

        end_str!();

        *e = new_tpl.into();
    }

    /// Converts template literals to string if `exprs` of [Tpl] is empty.
    pub(super) fn convert_tpl_to_str(&mut self, e: &mut Expr) {
        match e {

Review comment (suggestion):
Grammar issue: "quasis" should be singular "quasi" to match the article "the first".
```suggestion
                    // Store the first quasi for later concat
                    let first = quasis_taken[0].take();
                    push_str!(first);

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

                        // Store the last quasi for later concat
```

Code after:
        // 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
                        let last = quasis_taken.pop().unwrap();
                        push_str!(last);

                        // Append the rest of quasis and exprs to new_tpl
                        new_tpl.quasis.extend(quasis_taken.into_iter().skip(1));
                        new_tpl.exprs.extend(tpl.exprs.into_iter());
                    }
                }
                _ => {
                    end_str!();

                    new_tpl.exprs.push(e);
                }
            }
            push_str!(q);
        }

        end_str!();

        *e = new_tpl.into();
    }

    /// Converts template literals to string if `exprs` of [Tpl] is empty.
    pub(super) fn convert_tpl_to_str(&mut self, e: &mut Expr) {
        match e {