cargo fmt/clippy

master
Devin R 2020-03-29 08:07:25 -04:00
parent 4c7acd4b18
commit 05b6f4679a
3 changed files with 14 additions and 12 deletions

View File

@ -30,9 +30,9 @@ use url::Url;
use ruma_api::{Endpoint, Outgoing}; use ruma_api::{Endpoint, Outgoing};
use ruma_events::collections::all::RoomEvent; use ruma_events::collections::all::RoomEvent;
use ruma_events::presence::PresenceEvent;
use ruma_events::room::message::MessageEventContent; use ruma_events::room::message::MessageEventContent;
use ruma_events::EventResult; use ruma_events::EventResult;
use ruma_events::presence::PresenceEvent;
pub use ruma_events::EventType; pub use ruma_events::EventType;
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
@ -48,7 +48,8 @@ type RoomEventCallback = Box<
>; >;
type PresenceEventCallback = Box< type PresenceEventCallback = Box<
dyn FnMut(Arc<SyncLock<Room>>, Arc<EventResult<PresenceEvent>>) -> BoxFuture<'static, ()> + Send, dyn FnMut(Arc<SyncLock<Room>>, Arc<EventResult<PresenceEvent>>) -> BoxFuture<'static, ()>
+ Send,
>; >;
const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30);
@ -405,7 +406,9 @@ impl AsyncClient {
/// ``` /// ```
pub fn add_presence_callback<C: 'static>( pub fn add_presence_callback<C: 'static>(
&mut self, &mut self,
mut callback: impl FnMut(Arc<SyncLock<Room>>, Arc<EventResult<PresenceEvent>>) -> C + 'static + Send, mut callback: impl FnMut(Arc<SyncLock<Room>>, Arc<EventResult<PresenceEvent>>) -> C
+ 'static
+ Send,
) where ) where
C: Future<Output = ()> + Send, C: Future<Output = ()> + Send,
{ {

View File

@ -87,13 +87,12 @@ impl RoomMember {
self.user.display_name = event.content.displayname.clone(); self.user.display_name = event.content.displayname.clone();
self.user.avatar_url = event.content.avatar_url.clone(); self.user.avatar_url = event.content.avatar_url.clone();
true true
}, }
Banned | Kicked | KickedAndBanned Banned | Kicked | KickedAndBanned | InvitationRejected | InvitationRevoked | Left
| InvitationRejected | InvitationRevoked | Unbanned | Joined | Invited => {
| Left | Unbanned | Joined | Invited => { self.membership = event.content.membership;
self.membership = event.content.membership; true
true }
},
NotImplemented => false, NotImplemented => false,
None => false, None => false,
// TODO should this be handled somehow ?? // TODO should this be handled somehow ??

View File

@ -104,7 +104,7 @@ impl User {
} }
/// Updates the `User`s presence. /// Updates the `User`s presence.
/// ///
/// This should only be used if `did_update_presence` was true. /// This should only be used if `did_update_presence` was true.
/// ///
/// # Arguments /// # Arguments
@ -123,7 +123,7 @@ impl User {
}, },
.. ..
} = presence_ev; } = presence_ev;
self.presence_events.push(presence_ev.clone()); self.presence_events.push(presence_ev.clone());
*self = User { *self = User {
display_name: displayname.clone(), display_name: displayname.clone(),