From 3d8bacef5f96c4e08767470e4db52b0d7a44546a Mon Sep 17 00:00:00 2001 From: Bryan Woods Date: Tue, 17 Dec 2024 21:23:15 -0800 Subject: [PATCH] `RecursiveReducer` reduces parent _after_ children --- .../src/derive_macros/derive_reducers/src/enums.rs | 4 ++-- .../src/derive_macros/derive_reducers/src/structs.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composable-architecture/src/derive_macros/derive_reducers/src/enums.rs b/composable-architecture/src/derive_macros/derive_reducers/src/enums.rs index bc202d09..87d88330 100644 --- a/composable-architecture/src/derive_macros/derive_reducers/src/enums.rs +++ b/composable-architecture/src/derive_macros/derive_reducers/src/enums.rs @@ -40,13 +40,13 @@ pub fn derive_macro(identifier: Ident, data: DataEnum) -> TokenStream { action: Self::Action, send: impl composable::Effects, ) { - ::reduce(self, action.clone(), send.clone()); - #[allow(unreachable_patterns)] match self { #( #child_reducers )* _ => {} } + + ::reduce(self, action.clone(), send.clone()); } } }; diff --git a/composable-architecture/src/derive_macros/derive_reducers/src/structs.rs b/composable-architecture/src/derive_macros/derive_reducers/src/structs.rs index 3a52be6f..1b828d45 100644 --- a/composable-architecture/src/derive_macros/derive_reducers/src/structs.rs +++ b/composable-architecture/src/derive_macros/derive_reducers/src/structs.rs @@ -38,9 +38,9 @@ pub fn derive_macro(identifier: Ident, data: DataStruct) -> TokenStream { action: Self::Action, send: impl composable::Effects, ) { - ::reduce(self, action.clone(), send.clone()); - #( #child_reducers )* + + ::reduce(self, action.clone(), send.clone()); } } };