Repository: diesel-rs/diesel
File: diesel_derives/src/sql_function.rs (Rust)

Code before:
                Meta::NameValue(MetaNameValue { path, .. }) => path.is_ident("doc"),
                _ => false,
            })
            .unwrap_or(attributes.len());

    let fn_family = format!("`{0}_0`, `{0}_1`, ... `{0}_n`", fn_name);

    let doc_comments: Vec<Attribute> = parse_quote! {
        ///
        /// # Variadic functions
        ///
        /// This function is variadic in SQL, so there's a family of functions
        /// on a diesel side:
        ///
        #[doc = #fn_family]
        ///
        /// Here, the postfix number indicates repetitions of variadic arguments.
        /// To use this function, the appropriate version with the correct
        /// argument count must be selected.
        ///
        /// ## Controlling the generation of variadic function variants
        ///
        /// By default, only variants with 0, 1, and 2 repetitions of variadic
        /// arguments are generated. To generate more variants, set the
        /// `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired
        /// number of variants.
        #[doc(alias = #fn_name)]
    };

    for new_attribute in doc_comments {
        attributes.insert(doc_comments_end, new_attribute);
        doc_comments_end += 1;
    }
}

fn parse_sql_name_attr(input: &mut SqlFunctionDecl) -> Option<String> {
    let result = input
        .attributes
        .iter()
        .find(|attr| attr.meta.path().is_ident("sql_name"))
        .and_then(|attr| {
            if let Meta::NameValue(MetaNameValue {
                value:
                    syn::Expr::Lit(syn::ExprLit {
                        lit: syn::Lit::Str(ref lit),
                        ..
                    }),
                ..
            }) = attr.meta
            {
                Some(lit.value())

Review comment (suggestion):
Similar to the other doc comment mention this setting: We should include some more details on how users actually can set this.

Code after:
                Meta::NameValue(MetaNameValue { path, .. }) => path.is_ident("doc"),
                _ => false,
            })
            .unwrap_or(attributes.len());

    let fn_family = format!("`{0}_0`, `{0}_1`, ... `{0}_n`", fn_name);

    let doc_comments: Vec<Attribute> = parse_quote! {
        ///
        /// # Variadic functions
        ///
        /// This function is variadic in SQL, so there's a family of functions
        /// on a diesel side:
        ///
        #[doc = #fn_family]
        ///
        /// Here, the postfix number indicates repetitions of variadic arguments.
        /// To use this function, the appropriate version with the correct
        /// argument count must be selected.
        ///
        /// ## Controlling the generation of variadic function variants
        ///
        /// By default, only variants with 0, 1, and 2 repetitions of variadic
        /// arguments are generated. To generate more variants, set the
        /// `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired
        /// number of variants.
        ///
        /// For a greater convenience this environment variable can also be set
        /// in a `.cargo/config.toml` file as described in the
        /// [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env).
        #[doc(alias = #fn_name)]
    };

    for new_attribute in doc_comments {
        attributes.insert(doc_comments_end, new_attribute);
        doc_comments_end += 1;
    }
}

fn parse_sql_name_attr(input: &mut SqlFunctionDecl) -> Option<String> {
    let result = input
        .attributes
        .iter()
        .find(|attr| attr.meta.path().is_ident("sql_name"))
        .and_then(|attr| {
            if let Meta::NameValue(MetaNameValue {
                value:
                    syn::Expr::Lit(syn::ExprLit {
                        lit: syn::Lit::Str(ref lit),
                        ..
                    }),