aboutsummaryrefslogtreecommitdiffstats
path: root/src/bot
diff options
context:
space:
mode:
Diffstat (limited to 'src/bot')
-rw-r--r--src/bot/master.rs8
-rw-r--r--src/bot/music.rs5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/bot/master.rs b/src/bot/master.rs
index 4cdb490..7612c68 100644
--- a/src/bot/master.rs
+++ b/src/bot/master.rs
@@ -119,7 +119,7 @@ impl MasterBot {
ref connected_bots,
} = &mut *self.music_bots.write().expect("RwLock was not poisoned");
- for (_, bot) in connected_bots {
+ for bot in connected_bots.values() {
if bot.my_channel() == channel {
return Err(BotCreationError::MultipleBots(bot.name().to_owned()));
}
@@ -209,7 +209,7 @@ impl MasterBot {
let bot = music_bots.connected_bots.get(&name)?;
Some(crate::web_server::BotData {
- name: name,
+ name,
state: bot.state(),
volume: bot.volume(),
position: bot.position(),
@@ -244,7 +244,7 @@ impl MasterBot {
let len = music_bots.connected_bots.len();
let mut result = Vec::with_capacity(len);
- for (name, _) in &music_bots.connected_bots {
+ for name in music_bots.connected_bots.keys() {
result.push(name.clone());
}
@@ -253,7 +253,7 @@ impl MasterBot {
pub fn quit(&self, reason: String) {
let music_bots = self.music_bots.read().unwrap();
- for (_, bot) in &music_bots.connected_bots {
+ for bot in music_bots.connected_bots.values() {
bot.quit(reason.clone())
}
let sender = self.sender.read().unwrap();
diff --git a/src/bot/music.rs b/src/bot/music.rs
index 14a73f9..71e7b58 100644
--- a/src/bot/music.rs
+++ b/src/bot/music.rs
@@ -4,7 +4,6 @@ use std::sync::{Arc, RwLock};
use std::thread;
use std::time::Duration;
-use humantime;
use log::{debug, info};
use serde::Serialize;
use structopt::StructOpt;
@@ -56,7 +55,7 @@ pub enum MusicBotMessage {
ChannelCreated(ChannelId),
ClientDisconnected {
id: ClientId,
- client: data::Client,
+ client: Box<data::Client>,
},
StateChange(State),
Quit(String),
@@ -284,7 +283,7 @@ impl MusicBot {
async fn on_text(&self, message: Message) -> Result<(), AudioPlayerError> {
let msg = message.text;
- if msg.starts_with("!") {
+ if msg.starts_with('!') {
let tokens = msg[1..].split_whitespace().collect::<Vec<_>>();
match Command::from_iter_safe(&tokens) {