From f9b3a4836e7a8d4388ee6ebf289885f805720f5b Mon Sep 17 00:00:00 2001 From: Maximilian Siling Date: Tue, 10 Mar 2020 23:28:38 +0300 Subject: [PATCH] Various style fixes * Removed type bounds from struct declaration * Simplified >::Error to S::Error * Simplified complex type to BoxFuture --- .../dialogue/dialogue_dispatcher.rs | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/dispatching/dialogue/dialogue_dispatcher.rs b/src/dispatching/dialogue/dialogue_dispatcher.rs index 98060b3c..0181a564 100644 --- a/src/dispatching/dialogue/dialogue_dispatcher.rs +++ b/src/dispatching/dialogue/dialogue_dispatcher.rs @@ -5,9 +5,9 @@ use crate::dispatching::{ }, DispatcherHandler, DispatcherHandlerCx, }; -use std::{convert::Infallible, future::Future, marker::PhantomData, pin::Pin}; +use std::{convert::Infallible, marker::PhantomData}; -use futures::StreamExt; +use futures::{future::BoxFuture, StreamExt}; use tokio::sync::mpsc; use lockfree::map::Map; @@ -23,10 +23,7 @@ use std::sync::{Arc, Mutex}; /// /// [`Dispatcher`]: crate::dispatching::Dispatcher /// [`DispatcherHandler`]: crate::dispatching::DispatcherHandler -pub struct DialogueDispatcher -where - S: Storage + Send + Sync + 'static, -{ +pub struct DialogueDispatcher { storage: Arc, handler: Arc, _phantom: PhantomData>, @@ -63,14 +60,11 @@ where impl DialogueDispatcher where - H: DialogueDispatcherHandler>::Error> - + Send - + Sync - + 'static, + H: DialogueDispatcherHandler + Send + Sync + 'static, Upd: GetChatId + Send + 'static, D: Default + Send + 'static, S: Storage + Send + Sync + 'static, - >::Error: Send + 'static, + S::Error: Send + 'static, { /// Creates a dispatcher with the specified `handler` and `storage`. #[must_use] @@ -142,19 +136,16 @@ where impl DispatcherHandler for DialogueDispatcher where - H: DialogueDispatcherHandler>::Error> - + Send - + Sync - + 'static, + H: DialogueDispatcherHandler + Send + Sync + 'static, Upd: GetChatId + Send + 'static, D: Default + Send + 'static, S: Storage + Send + Sync + 'static, - >::Error: Send + 'static, + S::Error: Send + 'static, { fn handle( self, updates: mpsc::UnboundedReceiver>, - ) -> Pin + Send + 'static>> + ) -> BoxFuture<'static, ()> where DispatcherHandlerCx: 'static, {