diff options
| author | Zeyla Hellyer <[email protected]> | 2017-04-25 15:48:13 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-04-25 15:48:13 -0700 |
| commit | 0f41ffc811827fdd45e4e631884909e33fa8769e (patch) | |
| tree | 40c6d5091097ee86ed72e9868f77350bdaed078a /src/model/channel | |
| parent | Fix decoding for `CurrentUser.discriminator` (diff) | |
| download | serenity-0f41ffc811827fdd45e4e631884909e33fa8769e.tar.xz serenity-0f41ffc811827fdd45e4e631884909e33fa8769e.zip | |
Make `User.discriminator` a u16
Change the User struct's `discriminator` field to a u16 for performance.
The User struct's `discriminator` field was previously a u16 but changed
to a `String` for ease-of-use. Lately the library has been gearing more
towards performance where possible while not sacrificing ergonomics
_too much_ in most scenarios.
Diffstat (limited to 'src/model/channel')
| -rw-r--r-- | src/model/channel/message.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index 5dc59a1..13178ba 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -1,3 +1,4 @@ +use std::fmt::Write; use std::mem; use ::constants; use ::client::rest; @@ -199,7 +200,7 @@ impl Message { at_distinct.push('@'); at_distinct.push_str(&u.name); at_distinct.push('#'); - at_distinct.push_str(&u.discriminator); + let _ = write!(at_distinct, "{}", u.discriminator); result = result.replace(&u.mention(), &at_distinct); } |