diff options
| author | Zeyla Hellyer <[email protected]> | 2017-02-28 11:43:53 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-02-28 11:43:53 -0800 |
| commit | 28743c8632458b79b472e3719d4754b57e116ad0 (patch) | |
| tree | 2c892dfbc7651577d4c576ad9d6c395e0523c61b /src/client/mod.rs | |
| parent | Standardize message editing methods (diff) | |
| download | serenity-28743c8632458b79b472e3719d4754b57e116ad0.tar.xz serenity-28743c8632458b79b472e3719d4754b57e116ad0.zip | |
Pass by reference where possible
A lot of the `rest` methods took - for example a Map - by value, where
they could instead take a reference. While this only prevents one clone
in the library, user-land code should no longer need to clone maps when
using the `rest` module.
Diffstat (limited to 'src/client/mod.rs')
| -rw-r--r-- | src/client/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index 0da4b0e..0261833 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -782,7 +782,7 @@ impl Client { for shard_number in shards_index..shards_total { let shard_info = shard_data.map(|s| [shard_number, s[2]]); - let boot = boot_shard(BootInfo { + let boot = boot_shard(&BootInfo { gateway_url: gateway_url.clone(), login_type: self.login_type, shard_info: shard_info, @@ -1195,7 +1195,7 @@ struct MonitorInfo { token: String, } -fn boot_shard(info: BootInfo) -> Result<(Shard, ReadyEvent, Receiver<WebSocketStream>)> { +fn boot_shard(info: &BootInfo) -> Result<(Shard, ReadyEvent, Receiver<WebSocketStream>)> { // Make ten attempts to boot the shard, exponentially backing off; if it // still doesn't boot after that, accept it as a failure. // @@ -1250,7 +1250,7 @@ fn monitor_shard(mut info: MonitorInfo) { let mut boot_successful = false; for _ in 0..3 { - let boot = boot_shard(BootInfo { + let boot = boot_shard(&BootInfo { gateway_url: info.gateway_url.clone(), login_type: info.login_type, shard_info: info.shard_info, |