aboutsummaryrefslogtreecommitdiff
path: root/src/model/misc.rs
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-08-12 21:43:59 +0200
committerzeyla <[email protected]>2018-08-12 12:43:59 -0700
commit71edc3a11ac450728bca19ca7cab7c84079d59f0 (patch)
treebc6197f96ba9118ffa0b104c8434585d38bb6032 /src/model/misc.rs
parentRevert "Send silence frames upon connection (Fix #301)" (diff)
downloadserenity-71edc3a11ac450728bca19ca7cab7c84079d59f0.tar.xz
serenity-71edc3a11ac450728bca19ca7cab7c84079d59f0.zip
Use `to_`- and `as_`-methods instead of `get` and `find` on Id newtypes
Diffstat (limited to 'src/model/misc.rs')
-rw-r--r--src/model/misc.rs17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/model/misc.rs b/src/model/misc.rs
index 5c0825a..ff0f3de 100644
--- a/src/model/misc.rs
+++ b/src/model/misc.rs
@@ -119,7 +119,7 @@ impl FromStr for User {
fn from_str(s: &str) -> StdResult<Self, Self::Err> {
match utils::parse_username(s) {
Some(x) => UserId(x as u64)
- .get()
+ .to_user()
.map_err(|e| UserParseError::Rest(Box::new(e))),
_ => Err(UserParseError::InvalidUsername),
}
@@ -190,21 +190,6 @@ macro_rules! impl_from_str {
}
}
}
-
- #[cfg(all(feature = "cache", feature = "model", feature = "utils"))]
- impl FromStr for $struct {
- type Err = $err;
-
- fn from_str(s: &str) -> StdResult<Self, Self::Err> {
- match utils::$parse_fn(s) {
- Some(x) => match $id(x).find() {
- Some(user) => Ok(user),
- _ => Err($err::NotPresentInCache),
- },
- _ => Err($err::$invalid_variant),
- }
- }
- }
)*
};
}