Repository: pola-rs/polars
File: crates/polars-plan/src/plans/conversion/dsl_to_ir/functions.rs (Rust)

Code before:
                L::Sort(sort_options) => IL::Sort(sort_options),
                L::Reverse => IL::Reverse,
                L::Unique(v) => IL::Unique(v),
                L::NUnique => IL::NUnique,
                #[cfg(feature = "list_sets")]
                L::SetOperation(set_operation) => IL::SetOperation(set_operation),
                #[cfg(feature = "list_any_all")]
                L::Any => IL::Any,
                #[cfg(feature = "list_any_all")]
                L::All => IL::All,
                L::Join(v) => IL::Join(v),
                #[cfg(feature = "dtype-array")]
                L::ToArray(v) => IL::ToArray(v),
                #[cfg(feature = "list_to_struct")]
                L::ToStruct(list_to_struct_args) => IL::ToStruct(list_to_struct_args),
            })
        },
        #[cfg(feature = "strings")]
        F::StringExpr(string_function) => {
            use {IRStringFunction as IS, StringFunction as S};
            I::StringExpr(match string_function {
                S::Format { format, insertions } => {
                    if input_is_empty {
                        polars_ensure!(
                            insertions.is_empty(),
                            ComputeError: "StringFormat didn't get any inputs, format: {}",
                            format
                        );

                        let out = ctx
                            .arena
                            .add(AExpr::Literal(LiteralValue::Scalar(Scalar::from(format))));

                        return Ok((out, get_literal_name().clone()));
                    } else {
                        IS::Format { format, insertions }
                    }
                },
                #[cfg(feature = "concat_str")]
                S::ConcatHorizontal {
                    delimiter,
                    ignore_nulls,
                } => IS::ConcatHorizontal {
                    delimiter,
                    ignore_nulls,
                },
                #[cfg(feature = "concat_str")]
                S::ConcatVertical {
                    delimiter,
                    ignore_nulls,
                } => IS::ConcatVertical {

Review comment (suggestion):
Probably want quotes around the passed string to clarify empty string inputs, and you can use inline format notation: `didn't get any inputs, format: '{format}'`.

Code after:
                L::Sort(sort_options) => IL::Sort(sort_options),
                L::Reverse => IL::Reverse,
                L::Unique(v) => IL::Unique(v),
                L::NUnique => IL::NUnique,
                #[cfg(feature = "list_sets")]
                L::SetOperation(set_operation) => IL::SetOperation(set_operation),
                #[cfg(feature = "list_any_all")]
                L::Any => IL::Any,
                #[cfg(feature = "list_any_all")]
                L::All => IL::All,
                L::Join(v) => IL::Join(v),
                #[cfg(feature = "dtype-array")]
                L::ToArray(v) => IL::ToArray(v),
                #[cfg(feature = "list_to_struct")]
                L::ToStruct(list_to_struct_args) => IL::ToStruct(list_to_struct_args),
            })
        },
        #[cfg(feature = "strings")]
        F::StringExpr(string_function) => {
            use {IRStringFunction as IS, StringFunction as S};
            I::StringExpr(match string_function {
                S::Format { format, insertions } => {
                    if input_is_empty {
                        polars_ensure!(
                            insertions.is_empty(),
                            ComputeError: "StringFormat didn't get any inputs, format: \"{}\"",
                            format
                        );

                        let out = ctx
                            .arena
                            .add(AExpr::Literal(LiteralValue::Scalar(Scalar::from(format))));

                        return Ok((out, get_literal_name().clone()));
                    } else {
                        IS::Format { format, insertions }
                    }
                },
                #[cfg(feature = "concat_str")]
                S::ConcatHorizontal {
                    delimiter,
                    ignore_nulls,
                } => IS::ConcatHorizontal {
                    delimiter,
                    ignore_nulls,
                },
                #[cfg(feature = "concat_str")]
                S::ConcatVertical {
                    delimiter,
                    ignore_nulls,
                } => IS::ConcatVertical {