aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-12-14 14:57:24 +0100
committeracdenisSK <[email protected]>2017-12-14 14:57:24 +0100
commit6eafc80b01d8b4d43b376acc6faa45f60dddd075 (patch)
tree403d08994689703330e53f8ff6d6550dfdda6d68 /src
parentRemove the `Box<Command>` impl (diff)
downloadserenity-6eafc80b01d8b4d43b376acc6faa45f60dddd075.tar.xz
serenity-6eafc80b01d8b4d43b376acc6faa45f60dddd075.zip
Make `Context::edit_profile` slightly efficient
Diffstat (limited to 'src')
-rw-r--r--src/client/context.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/context.rs b/src/client/context.rs
index 88fd157..2be1d99 100644
--- a/src/client/context.rs
+++ b/src/client/context.rs
@@ -85,7 +85,7 @@ impl Context {
/// ```
#[cfg(feature = "builder")]
pub fn edit_profile<F: FnOnce(EditProfile) -> EditProfile>(&self, f: F) -> Result<CurrentUser> {
- let mut map = HashMap::new();
+ let mut map = HashMap::with_capacity(2);
feature_cache! {
{
@@ -101,8 +101,8 @@ impl Context {
map.insert("username", Value::String(user.name.clone()));
- if let Some(email) = user.email.as_ref() {
- map.insert("email", Value::String(email.clone()));
+ if let Some(email) = user.email {
+ map.insert("email", Value::String(email));
}
}
}