diff options
| author | Zeyla Hellyer <[email protected]> | 2017-06-14 19:37:37 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-14 19:37:37 -0700 |
| commit | d3b094aad90b5387b79de01b83ba5f1d7e766705 (patch) | |
| tree | 71c8444b0d57e0ec4b531d380eb042d64d0cd5c6 /examples | |
| parent | Reset shard handling on reconnects (diff) | |
| download | serenity-d3b094aad90b5387b79de01b83ba5f1d7e766705.tar.xz serenity-d3b094aad90b5387b79de01b83ba5f1d7e766705.zip | |
Run clippy on examples
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/05_command_framework/src/main.rs | 8 | ||||
| -rw-r--r-- | examples/06_voice/src/main.rs | 14 |
2 files changed, 9 insertions, 13 deletions
diff --git a/examples/05_command_framework/src/main.rs b/examples/05_command_framework/src/main.rs index 4d5ead4..2f7d57c 100644 --- a/examples/05_command_framework/src/main.rs +++ b/examples/05_command_framework/src/main.rs @@ -95,12 +95,8 @@ fn main() { // reason or another. For example, when a user has exceeded a rate-limit or a command // can only be performed by the bot owner. .on_dispatch_error(|_ctx, msg, error| { - match error { - DispatchError::RateLimited(seconds) => { - let _ = msg.channel_id.say(&format!("Try this again in {} seconds.", seconds)); - }, - // Any other error would be silently ignored. - _ => {}, + if let DispatchError::RateLimited(seconds) = error { + let _ = msg.channel_id.say(&format!("Try this again in {} seconds.", seconds)); } }) // Can't be used more than once per 5 seconds: diff --git a/examples/06_voice/src/main.rs b/examples/06_voice/src/main.rs index 5236376..b194548 100644 --- a/examples/06_voice/src/main.rs +++ b/examples/06_voice/src/main.rs @@ -43,7 +43,7 @@ fn main() { } command!(deafen(ctx, msg) { - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Groups and DMs not supported")); @@ -89,7 +89,7 @@ command!(join(ctx, msg, args) { }, }; - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Groups and DMs not supported")); @@ -105,7 +105,7 @@ command!(join(ctx, msg, args) { }); command!(leave(ctx, msg) { - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Groups and DMs not supported")); @@ -127,7 +127,7 @@ command!(leave(ctx, msg) { }); command!(mute(ctx, msg) { - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Groups and DMs not supported")); @@ -176,7 +176,7 @@ command!(play(ctx, msg, args) { return Ok(()); } - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Error finding channel info")); @@ -206,7 +206,7 @@ command!(play(ctx, msg, args) { }); command!(undeafen(ctx, msg) { - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Error finding channel info")); @@ -225,7 +225,7 @@ command!(undeafen(ctx, msg) { }); command!(unmute(ctx, msg) { - let guild_id = match CACHE.read().unwrap().get_guild_channel(msg.channel_id) { + let guild_id = match CACHE.read().unwrap().guild_channel(msg.channel_id) { Some(channel) => channel.read().unwrap().guild_id, None => { check_msg(msg.channel_id.say("Error finding channel info")); |