Tweak formattting in macros.

- Some lines are too long.
- Some whitespace is excessive.
This commit is contained in:
Nicholas Nethercote 2025-07-14 15:58:51 +10:00
parent 14c8de25e1
commit e40a275fe4
6 changed files with 36 additions and 66 deletions

View File

@ -13,7 +13,9 @@ pub(crate) fn impl_from_arg(where_clause_options: &WhereClauseOptions) -> proc_m
quote! {
impl #impl_generics #bevy_reflect::func::args::FromArg for #type_path #ty_generics #where_reflect_clause {
type This<'from_arg> = #type_path #ty_generics;
fn from_arg(arg: #bevy_reflect::func::args::Arg) -> #FQResult<Self::This<'_>, #bevy_reflect::func::args::ArgError> {
fn from_arg(arg: #bevy_reflect::func::args::Arg) ->
#FQResult<Self::This<'_>, #bevy_reflect::func::args::ArgError>
{
arg.take_owned()
}
}

View File

@ -13,7 +13,9 @@ pub(crate) fn impl_into_return(
quote! {
impl #impl_generics #bevy_reflect::func::IntoReturn for #type_path #ty_generics #where_reflect_clause {
fn into_return<'into_return>(self) -> #bevy_reflect::func::Return<'into_return> where Self: 'into_return {
fn into_return<'into_return>(self) -> #bevy_reflect::func::Return<'into_return>
where Self: 'into_return
{
#bevy_reflect::func::Return::Owned(#bevy_reflect::__macro_exports::alloc_utils::Box::new(self))
}
}

View File

@ -59,18 +59,13 @@ macro_rules! impl_from_arg {
(
$ty: ty
$(;
<
$($T: ident $(: $T1: tt $(+ $T2: tt)*)?),*
>
< $($T: ident $(: $T1: tt $(+ $T2: tt)*)?),* >
)?
$(
[
$(const $N: ident : $size: ident),*
]
[ $(const $N: ident : $size: ident),* ]
)?
$(
where
$($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
where $($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
)?
) => {
impl <
@ -78,12 +73,13 @@ macro_rules! impl_from_arg {
$(, $(const $N : $size),*)?
> $crate::func::args::FromArg for $ty
$(
where
$($U $(: $U1 $(+ $U2)*)?),*
where $($U $(: $U1 $(+ $U2)*)?),*
)?
{
type This<'from_arg> = $ty;
fn from_arg(arg: $crate::func::args::Arg) -> Result<Self::This<'_>, $crate::func::args::ArgError> {
fn from_arg(arg: $crate::func::args::Arg) ->
Result<Self::This<'_>, $crate::func::args::ArgError>
{
arg.take_owned()
}
}

View File

@ -65,18 +65,13 @@ macro_rules! impl_get_ownership {
(
$ty: ty
$(;
<
$($T: ident $(: $T1: tt $(+ $T2: tt)*)?),*
>
< $($T: ident $(: $T1: tt $(+ $T2: tt)*)?),* >
)?
$(
[
$(const $N: ident : $size: ident),*
]
[ $(const $N: ident : $size: ident),* ]
)?
$(
where
$($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
where $($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
)?
) => {
impl <
@ -84,8 +79,7 @@ macro_rules! impl_get_ownership {
$(, $(const $N : $size),*)?
> $crate::func::args::GetOwnership for $ty
$(
where
$($U $(: $U1 $(+ $U2)*)?),*
where $($U $(: $U1 $(+ $U2)*)?),*
)?
{}
};

View File

@ -28,69 +28,49 @@ macro_rules! impl_function_traits {
(
$ty: ty
$(;
<
$($T: ident $(: $T1: tt $(+ $T2: tt)*)?),*
>
< $($T: ident $(: $T1: tt $(+ $T2: tt)*)?),* >
)?
$(
[
$(const $N: ident : $size: ident),*
]
[ $(const $N: ident : $size: ident),* ]
)?
$(
where
$($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
where $($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
)?
) => {
$crate::func::args::impl_get_ownership!(
$ty
$(;
<
$($T $(: $T1 $(+ $T2)*)?),*
>
< $($T $(: $T1 $(+ $T2)*)?),* >
)?
$(
[
$(const $N : $size),*
]
[ $(const $N : $size),* ]
)?
$(
where
$($U $(: $U1 $(+ $U2)*)?),*
where $($U $(: $U1 $(+ $U2)*)?),*
)?
);
$crate::func::args::impl_from_arg!(
$ty
$(;
<
$($T $(: $T1 $(+ $T2)*)?),*
>
< $($T $(: $T1 $(+ $T2)*)?),* >
)?
$(
[
$(const $N : $size),*
]
[ $(const $N : $size),* ]
)?
$(
where
$($U $(: $U1 $(+ $U2)*)?),*
where $($U $(: $U1 $(+ $U2)*)?),*
)?
);
$crate::func::impl_into_return!(
$ty
$(;
<
$($T $(: $T1 $(+ $T2)*)?),*
>
< $($T $(: $T1 $(+ $T2)*)?),* >
)?
$(
[
$(const $N : $size),*
]
[ $(const $N : $size),* ]
)?
$(
where
$($U $(: $U1 $(+ $U2)*)?),*
where $($U $(: $U1 $(+ $U2)*)?),*
)?
);
};

View File

@ -126,18 +126,13 @@ macro_rules! impl_into_return {
(
$ty: ty
$(;
<
$($T: ident $(: $T1: tt $(+ $T2: tt)*)?),*
>
< $($T: ident $(: $T1: tt $(+ $T2: tt)*)?),* >
)?
$(
[
$(const $N: ident : $size: ident),*
]
[ $(const $N: ident : $size: ident),* ]
)?
$(
where
$($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
where $($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*
)?
) => {
impl <
@ -145,11 +140,12 @@ macro_rules! impl_into_return {
$(, $(const $N : $size),*)?
> $crate::func::IntoReturn for $ty
$(
where
$($U $(: $U1 $(+ $U2)*)?),*
where $($U $(: $U1 $(+ $U2)*)?),*
)?
{
fn into_return<'into_return>(self) -> $crate::func::Return<'into_return> where Self: 'into_return {
fn into_return<'into_return>(self) -> $crate::func::Return<'into_return>
where Self: 'into_return
{
$crate::func::Return::Owned(bevy_platform::prelude::Box::new(self))
}
}