Skip to content

Commit 2472010

Browse files
authored
Remove redundant $arg: ident of the impl_typed_function macro (#21241)
# Objective bevy_reflect: function reflection The `$arg: ident` in macro `impl_typed_function` is redundant. It is not used internally at all. So I removed it. ## Testing - `cargo run --features="reflect_functions" --example function_reflection` - `cargo test -p bevy_reflect --features="functions"` --- ## Showcase ```rust macro_rules! impl_typed_function { // ($(($Arg:ident, $arg:ident)),*) => { ($($Arg:ident),*) => { // ...... } } // all_tuples!(impl_typed_function, 0, 15, Arg, arg); all_tuples!(impl_typed_function, 0, 15, Arg); ```
1 parent 559b2a1 commit 2472010

File tree

1 file changed

+7
-7
lines changed
  • crates/bevy_reflect/src/func

1 file changed

+7
-7
lines changed

crates/bevy_reflect/src/func/info.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,13 @@ pub trait TypedFunction<Marker> {
600600

601601
/// Helper macro for implementing [`TypedFunction`] on Rust functions.
602602
///
603-
/// This currently implements it for the following signatures (where `argX` may be any of `T`, `&T`, or `&mut T`):
604-
/// - `FnMut(arg0, arg1, ..., argN) -> R`
605-
/// - `FnMut(&Receiver, arg0, arg1, ..., argN) -> &R`
606-
/// - `FnMut(&mut Receiver, arg0, arg1, ..., argN) -> &mut R`
607-
/// - `FnMut(&mut Receiver, arg0, arg1, ..., argN) -> &R`
603+
/// This currently implements it for the following signatures (where `ArgX` may be any of `T`, `&T`, or `&mut T`):
604+
/// - `FnMut(Arg0, Arg1, ..., ArgN) -> R`
605+
/// - `FnMut(&Receiver, Arg0, Arg1, ..., ArgN) -> &R`
606+
/// - `FnMut(&mut Receiver, Arg0, Arg1, ..., ArgN) -> &mut R`
607+
/// - `FnMut(&mut Receiver, Arg0, Arg1, ..., ArgN) -> &R`
608608
macro_rules! impl_typed_function {
609-
($(($Arg:ident, $arg:ident)),*) => {
609+
($($Arg:ident),*) => {
610610
// === (...) -> ReturnType === //
611611
impl<$($Arg,)* ReturnType, Function> TypedFunction<fn($($Arg),*) -> [ReturnType]> for Function
612612
where
@@ -711,7 +711,7 @@ macro_rules! impl_typed_function {
711711
};
712712
}
713713

714-
all_tuples!(impl_typed_function, 0, 15, Arg, arg);
714+
all_tuples!(impl_typed_function, 0, 15, Arg);
715715

716716
/// Helper function for creating [`FunctionInfo`] with the proper name value.
717717
///

0 commit comments

Comments
 (0)