diff options
| author | Zeyla Hellyer <[email protected]> | 2018-07-04 21:28:22 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-07-04 21:32:17 -0700 |
| commit | 7b9764cf1097b0620d871fabe67b5593f0cd4a4a (patch) | |
| tree | 5b9f3eac6e9c57ac255c73bd1eea07669838f32d /src/builder/edit_channel.rs | |
| parent | Fix dead doc-links and add missing ones. (#347) (diff) | |
| download | serenity-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/builder/edit_channel.rs')
| -rw-r--r-- | src/builder/edit_channel.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/builder/edit_channel.rs b/src/builder/edit_channel.rs index b8d897b..e1b62a7 100644 --- a/src/builder/edit_channel.rs +++ b/src/builder/edit_channel.rs @@ -80,13 +80,16 @@ impl EditChannel { /// /// [text]: ../model/channel/enum.ChannelType.html#variant.Text /// [voice]: ../model/channel/enum.ChannelType.html#variant.Voice - pub fn category<C>(mut self, category: C) -> Self - where C: Into<Option<ChannelId>> { - let parent_id = match category.into() { + #[inline] + pub fn category<C: Into<Option<ChannelId>>>(self, category: C) -> Self { + self._category(category.into()) + } + + fn _category(mut self, category: Option<ChannelId>) -> Self { + self.0.insert("parent_id", match category { Some(c) => Value::Number(Number::from(c.0)), None => Value::Null - }; - self.0.insert("parent_id", parent_id); + }); self } |