ion_proc/function/
inner.rs

1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6
7use quote::format_ident;
8use syn::punctuated::Punctuated;
9use syn::{ItemFn, parse_quote};
10
11use crate::function::parameter::Parameters;
12
13pub(crate) fn impl_inner_fn(mut function: ItemFn, parameters: &Parameters, keep_inner: bool) -> ItemFn {
14	function.attrs.push(parse_quote!(#[allow(clippy::needless_pass_by_value)]));
15	function.sig.inputs = Punctuated::from_iter(parameters.to_args());
16	if keep_inner {
17		function.sig.ident = format_ident!("inner", span = function.sig.ident.span());
18	}
19	function
20}