aboutsummaryrefslogtreecommitdiff
path: root/src/model/user.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-10-03 16:55:58 +0200
committeracdenisSK <[email protected]>2017-10-03 16:55:58 +0200
commit2233337d334e52b5c4cf7149097e70ef5c5433b3 (patch)
treeba14ca714fa7bc1e6ba1d26f10e7c170bdf10ffa /src/model/user.rs
parentUse the de-generification trick. (diff)
downloadserenity-2233337d334e52b5c4cf7149097e70ef5c5433b3.tar.xz
serenity-2233337d334e52b5c4cf7149097e70ef5c5433b3.zip
Revert "Use the de-generification trick."
Makes the compiliation time just a bit worse
Diffstat (limited to 'src/model/user.rs')
-rw-r--r--src/model/user.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/model/user.rs b/src/model/user.rs
index c3c3c0d..3ae33aa 100644
--- a/src/model/user.rs
+++ b/src/model/user.rs
@@ -573,19 +573,17 @@ impl User {
// no-cache would warn on guild_id.
pub fn has_role<G, R>(&self, guild: G, role: R) -> bool
where G: Into<GuildContainer>, R: Into<RoleId> {
- self._has_role(guild.into(), role.into())
- }
+ let role_id = role.into();
- fn _has_role(&self, guild: GuildContainer, role: RoleId) -> bool {
- match guild {
- GuildContainer::Guild(guild) => guild.roles.contains_key(&role),
+ match guild.into() {
+ GuildContainer::Guild(guild) => guild.roles.contains_key(&role_id),
GuildContainer::Id(_guild_id) => {
feature_cache! {{
CACHE.read()
.unwrap()
.guilds
.get(&_guild_id)
- .map(|g| g.read().unwrap().roles.contains_key(&role))
+ .map(|g| g.read().unwrap().roles.contains_key(&role_id))
.unwrap_or(false)
} else {
true