aboutsummaryrefslogtreecommitdiff
path: root/src/client/mod.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-24 10:50:58 -0800
committerAustin Hellyer <[email protected]>2017-01-24 10:50:58 -0800
commit8c5ee70b28b42ac92f899932ab2ddafeb9c6f913 (patch)
tree8116d495dd8360acbfee5b2e1199b333091aba51 /src/client/mod.rs
parentAvoid a needless clone on login (diff)
downloadserenity-8c5ee70b28b42ac92f899932ab2ddafeb9c6f913.tar.xz
serenity-8c5ee70b28b42ac92f899932ab2ddafeb9c6f913.zip
Avoid a lot of Arc/Message/RwLock clones
When passing monitoring info from the shard handler to the dispatch function, pass arguments by reference instead of by cloning and passing by reference. Additionally, don't re-clone handler Arcs and temporary Messages.
Diffstat (limited to 'src/client/mod.rs')
-rw-r--r--src/client/mod.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index 4b3b15f..04e8e08 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -802,11 +802,11 @@ impl Client {
feature_framework! {{
dispatch(Event::Ready(ready),
- shard.clone(),
- self.framework.clone(),
- self.data.clone(),
+ &shard,
+ &self.framework,
+ &self.data,
self.login_type,
- self.event_store.clone());
+ &self.event_store);
} else {
dispatch(Event::Ready(ready),
shard.clone(),
@@ -1269,17 +1269,17 @@ fn monitor_shard(mut info: MonitorInfo) {
feature_framework! {{
dispatch(Event::Ready(ready),
- info.shard.clone(),
- info.framework.clone(),
- info.data.clone(),
+ &info.shard,
+ &info.framework,
+ &info.data,
info.login_type,
- info.event_store.clone());
+ &info.event_store);
} else {
dispatch(Event::Ready(ready),
- info.shard.clone(),
- info.data.clone(),
+ &info.shard,
+ &info.data,
info.login_type,
- info.event_store.clone());
+ &info.event_store);
}}
break;
@@ -1338,11 +1338,11 @@ fn handle_shard(info: &mut MonitorInfo) {
feature_framework! {{
dispatch(event,
- info.shard.clone(),
- info.framework.clone(),
- info.data.clone(),
+ &info.shard,
+ &info.framework,
+ &info.data,
info.login_type,
- info.event_store.clone());
+ &info.event_store);
} else {
dispatch(event,
info.shard.clone(),