aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/group.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-07-04 21:28:22 -0700
committerZeyla Hellyer <[email protected]>2018-07-04 21:32:17 -0700
commit7b9764cf1097b0620d871fabe67b5593f0cd4a4a (patch)
tree5b9f3eac6e9c57ac255c73bd1eea07669838f32d /src/model/channel/group.rs
parentFix dead doc-links and add missing ones. (#347) (diff)
downloadserenity-7b9764cf1097b0620d871fabe67b5593f0cd4a4a.tar.xz
serenity-7b9764cf1097b0620d871fabe67b5593f0cd4a4a.zip
Monomorphize all functions
This commit monomorphizes all functions, turning functions like: ```rust fn foo<T: Into<Bar>>(baz: T) { baz = baz.into(); // function here } ``` Into functions like: ```rust fn foo<T: Into<Bar>>(baz: T) { _foo(baz.into()) } fn _foo(baz: Bar) { // function here } ``` This avoids binary bloat and improves build times, by reducing the amount of code duplication.
Diffstat (limited to 'src/model/channel/group.rs')
-rw-r--r--src/model/channel/group.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/model/channel/group.rs b/src/model/channel/group.rs
index 2fc062b..4baa654 100644
--- a/src/model/channel/group.rs
+++ b/src/model/channel/group.rs
@@ -53,9 +53,12 @@ impl Group {
/// user.
///
/// [`http::add_group_recipient`]: ../http/fn.add_group_recipient.html
+ #[inline]
pub fn add_recipient<U: Into<UserId>>(&self, user: U) -> Result<()> {
- let user = user.into();
+ self._add_recipient(user.into())
+ }
+ fn _add_recipient(&self, user: UserId) -> Result<()> {
// If the group already contains the recipient, do nothing.
if self.recipients.contains_key(&user) {
return Ok(());
@@ -261,9 +264,12 @@ impl Group {
/// the group, then nothing is done.
///
/// **Note**: This is only available to the group owner.
+ #[inline]
pub fn remove_recipient<U: Into<UserId>>(&self, user: U) -> Result<()> {
- let user = user.into();
+ self._remove_recipient(user.into())
+ }
+ fn _remove_recipient(&self, user: UserId) -> Result<()> {
// If the group does not contain the recipient already, do nothing.
if !self.recipients.contains_key(&user) {
return Ok(());