diff options
| author | Jokler <jokler@protonmail.com> | 2020-08-19 03:38:48 +0200 |
|---|---|---|
| committer | Jokler <jokler@protonmail.com> | 2020-08-19 03:38:48 +0200 |
| commit | 237e0c4fb48d9694c263f703a42f7790a99368ef (patch) | |
| tree | cd7f8351d92a2cd58c3eff08164a2eb7070d65f3 /src/teamspeak/mod.rs | |
| parent | 681950517d511d1c4b8e465f9b9758c027ecd6bf (diff) | |
| download | pokebot-237e0c4fb48d9694c263f703a42f7790a99368ef.tar.gz pokebot-237e0c4fb48d9694c263f703a42f7790a99368ef.zip | |
Run clippy and fmt
Diffstat (limited to 'src/teamspeak/mod.rs')
| -rw-r--r-- | src/teamspeak/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/teamspeak/mod.rs b/src/teamspeak/mod.rs index b53d1d0..66d973c 100644 --- a/src/teamspeak/mod.rs +++ b/src/teamspeak/mod.rs @@ -22,7 +22,7 @@ pub struct TeamSpeakConnection { conn: Connection, } -fn get_message<'a>(event: &Event) -> Option<MusicBotMessage> { +fn get_message(event: &Event) -> Option<MusicBotMessage> { use tsclientlib::events::{PropertyId, PropertyValue}; match event { @@ -39,9 +39,7 @@ fn get_message<'a>(event: &Event) -> Option<MusicBotMessage> { id: property, invoker: _, } => match property { - PropertyId::Channel(id) => { - Some(MusicBotMessage::ChannelCreated(*id)) - } + PropertyId::Channel(id) => Some(MusicBotMessage::ChannelCreated(*id)), _ => None, }, Event::PropertyChanged { @@ -70,7 +68,7 @@ fn get_message<'a>(event: &Event) -> Option<MusicBotMessage> { if let PropertyValue::Client(client) = client { Some(MusicBotMessage::ClientDisconnected { id: *id, - client: client.clone(), + client: Box::new(client.clone()), }) } else { None @@ -172,7 +170,7 @@ impl TeamSpeakConnection { pub fn user_count(&self, channel: ChannelId) -> u32 { let conn = self.conn.lock(); let mut count = 0; - for (_, client) in &conn.clients { + for client in conn.clients.values() { if client.channel == channel { count += 1; } |
