summaryrefslogtreecommitdiffstats
path: root/src/plugins/tell.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-02-24 20:13:32 +0100
committerJokler <jokler.contact@gmail.com>2018-02-24 20:13:32 +0100
commitce2db228aac1c0114bcac30bb6c01212faca025a (patch)
tree73dc3b12bbeccfcfde6151bc629a7d0e02397c88 /src/plugins/tell.rs
parentf24da1f5090d71a4963e05c5a76dad2eccac15bd (diff)
downloadfrippy-ce2db228aac1c0114bcac30bb6c01212faca025a.tar.gz
frippy-ce2db228aac1c0114bcac30bb6c01212faca025a.zip
Run rustfmt and clippy
Diffstat (limited to 'src/plugins/tell.rs')
-rw-r--r--src/plugins/tell.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/tell.rs b/src/plugins/tell.rs
index 34d7cf8..89d91f2 100644
--- a/src/plugins/tell.rs
+++ b/src/plugins/tell.rs
@@ -61,7 +61,9 @@ impl Tell {
};
let mut tells = try_lock!(self.tells);
- let tell_messages = tells.entry(receiver).or_insert(Vec::with_capacity(3));
+ let tell_messages = tells
+ .entry(receiver)
+ .or_insert_with(|| Vec::with_capacity(3));
(*tell_messages).push(tell);
Ok("Got it!")
@@ -75,7 +77,7 @@ impl Tell {
receiver,
&format!("Tell from {}: {}", tell.sender, tell.message),
) {
- return ExecutionStatus::Err(e);
+ return ExecutionStatus::Err(Box::new(e));
}
debug!(
"Sent {:?} from {:?} to {:?}",
@@ -107,8 +109,9 @@ impl Tell {
impl Plugin for Tell {
fn execute(&self, client: &IrcClient, message: &Message) -> ExecutionStatus {
match message.command {
- Command::JOIN(_, _, _) => self.send_tell(client, message.source_nickname().unwrap()),
- Command::PRIVMSG(_, _) => self.send_tell(client, message.source_nickname().unwrap()),
+ Command::JOIN(_, _, _) | Command::PRIVMSG(_, _) => {
+ self.send_tell(client, message.source_nickname().unwrap())
+ }
_ => ExecutionStatus::Done,
}
}