diff options
| author | acdenisSK <[email protected]> | 2017-10-08 22:49:22 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-10-08 22:49:22 +0200 |
| commit | 09a8a444f5bcefaee8b83dc129a3cea2de8792f9 (patch) | |
| tree | 8924d08ba98c8dfe5cf51c85cd07a03feb946f9d /src | |
| parent | Add an impl for `&str` (diff) | |
| download | serenity-09a8a444f5bcefaee8b83dc129a3cea2de8792f9.tar.xz serenity-09a8a444f5bcefaee8b83dc129a3cea2de8792f9.zip | |
Generate `Default` for CurrentUser and use it in `Cache::default`
Diffstat (limited to 'src')
| -rw-r--r-- | src/cache/mod.rs | 11 | ||||
| -rw-r--r-- | src/model/mod.rs | 2 | ||||
| -rw-r--r-- | src/model/user.rs | 2 |
3 files changed, 3 insertions, 12 deletions
diff --git a/src/cache/mod.rs b/src/cache/mod.rs index 2bbc9bc..9b43804 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -629,16 +629,7 @@ impl Default for Cache { private_channels: HashMap::with_capacity(128), shard_count: 1, unavailable_guilds: HashSet::default(), - user: CurrentUser { - avatar: None, - bot: false, - discriminator: 0, - email: None, - id: UserId(0), - mfa_enabled: false, - name: String::default(), - verified: false, - }, + user: CurrentUser::default(), users: HashMap::default(), } } diff --git a/src/model/mod.rs b/src/model/mod.rs index bf3ac07..0817094 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -48,7 +48,7 @@ macro_rules! id_u64 { ($(#[$attr:meta] $name:ident;)*) => { $( #[$attr] - #[derive(Copy, Clone, Debug, Eq, Hash, PartialOrd, Ord, Serialize)] + #[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialOrd, Ord, Serialize)] #[allow(derive_hash_xor_eq)] pub struct $name(pub u64); diff --git a/src/model/user.rs b/src/model/user.rs index 3ae33aa..39efa10 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -21,7 +21,7 @@ use CACHE; use http::{self, GuildPagination}; /// Information about the current user. -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Default, Debug, Deserialize)] pub struct CurrentUser { pub id: UserId, pub avatar: Option<String>, |