diff options
| author | Zeyla Hellyer <[email protected]> | 2017-04-13 20:45:56 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-04-19 14:53:32 -0700 |
| commit | 3f03f9adc97315bb61a5c71f52365306cb8e2d1a (patch) | |
| tree | 8fe0b518d1450b0657cfb75f56251fd90120807e /src/model/utils.rs | |
| parent | Update the way errors are handled in dispatch (diff) | |
| download | serenity-3f03f9adc97315bb61a5c71f52365306cb8e2d1a.tar.xz serenity-3f03f9adc97315bb61a5c71f52365306cb8e2d1a.zip | |
Deprecate methods prefixed with `get_`
A lot of structs - such as `Guild` or `ChannelId` - have methods with
prefixes of `get_`, which are generally discouraged. To fix this,
deprecate them and remove them in v0.3.0.
Diffstat (limited to 'src/model/utils.rs')
| -rw-r--r-- | src/model/utils.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/model/utils.rs b/src/model/utils.rs index ab7a8fb..3af5e80 100644 --- a/src/model/utils.rs +++ b/src/model/utils.rs @@ -128,13 +128,11 @@ pub fn deserialize_voice_states<D: Deserializer>(deserializer: D) } #[cfg(feature="cache")] -pub fn user_has_perms(channel_id: ChannelId, - mut permissions: Permissions) - -> Result<bool> { +pub fn user_has_perms(channel_id: ChannelId, mut permissions: Permissions) -> Result<bool> { let cache = CACHE.read().unwrap(); let current_user = &cache.user; - let channel = match cache.get_channel(channel_id) { + let channel = match cache.channel(channel_id) { Some(channel) => channel, None => return Err(Error::Client(ClientError::ItemMissing)), }; @@ -146,7 +144,7 @@ pub fn user_has_perms(channel_id: ChannelId, Channel::Guild(channel) => channel.read().unwrap().guild_id, }; - let guild = match cache.get_guild(guild_id) { + let guild = match cache.guild(guild_id) { Some(guild) => guild, None => return Err(Error::Client(ClientError::ItemMissing)), }; |