From cd51bba180f8b4c1901f451bfa5dec6264884f65 Mon Sep 17 00:00:00 2001 From: Hirrolot Date: Mon, 24 Jan 2022 13:20:13 +0600 Subject: [PATCH] Refactor `Dispatcher` --- src/dispatching2/dispatcher.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/dispatching2/dispatcher.rs b/src/dispatching2/dispatcher.rs index 0e5bbf0d..b73e0544 100644 --- a/src/dispatching2/dispatcher.rs +++ b/src/dispatching2/dispatcher.rs @@ -199,18 +199,14 @@ where let mut deps = self.dependencies.clone(); deps.insert(upd); deps.insert(self.requester.clone()); + match self.handler.dispatch(deps).await { ControlFlow::Break(Ok(())) => {} ControlFlow::Break(Err(err)) => { self.error_handler.clone().handle_error(err).await } ControlFlow::Continue(deps) => { - match self - .default_handler - .clone() - .execute(deps, |next| async move { match next {} }) - .await - { + match self.default_handler.clone().dispatch(deps).await { ControlFlow::Break(()) => {} ControlFlow::Continue(_) => unreachable!( "This is unreachable due to Infallible type in the DefaultHandler \