aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/message.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-18 17:48:52 -0700
committerZeyla Hellyer <[email protected]>2017-09-18 17:48:52 -0700
commitdae2cb77b407044f44a7a2790d93efba3891854e (patch)
treebef263c4490536cf8b56e988e71dd1aa43bc2696 /src/model/channel/message.rs
parentFix compiles of a variety of feature combinations (diff)
downloadserenity-dae2cb77b407044f44a7a2790d93efba3891854e.tar.xz
serenity-dae2cb77b407044f44a7a2790d93efba3891854e.zip
Apply rustfmt
Diffstat (limited to 'src/model/channel/message.rs')
-rw-r--r--src/model/channel/message.rs29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 1edc9a1..d36d290 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -292,10 +292,9 @@ impl Message {
}
// And finally replace everyone and here mentions.
- result.replace("@everyone", "@\u{200B}everyone").replace(
- "@here",
- "@\u{200B}here",
- )
+ result
+ .replace("@everyone", "@\u{200B}everyone")
+ .replace("@here", "@\u{200B}here")
}
/// Gets the list of [`User`]s who have reacted to a [`Message`] with a
@@ -321,12 +320,8 @@ impl Message {
after: Option<U>)
-> Result<Vec<User>>
where R: Into<ReactionType>, U: Into<UserId> {
- self.channel_id.reaction_users(
- self.id,
- reaction_type,
- limit,
- after,
- )
+ self.channel_id
+ .reaction_users(self.id, reaction_type, limit, after)
}
/// Returns the associated `Guild` for the message if one is in the cache.
@@ -339,9 +334,8 @@ impl Message {
/// [`guild_id`]: #method.guild_id
#[cfg(feature = "cache")]
pub fn guild(&self) -> Option<Arc<RwLock<Guild>>> {
- self.guild_id().and_then(|guild_id| {
- CACHE.read().unwrap().guild(guild_id)
- })
+ self.guild_id()
+ .and_then(|guild_id| CACHE.read().unwrap().guild(guild_id))
}
/// Retrieves the Id of the guild that the message was sent in, if sent in
@@ -361,8 +355,7 @@ impl Message {
#[cfg(feature = "cache")]
pub fn is_private(&self) -> bool {
match CACHE.read().unwrap().channel(self.channel_id) {
- Some(Channel::Group(_)) |
- Some(Channel::Private(_)) => true,
+ Some(Channel::Group(_)) | Some(Channel::Private(_)) => true,
_ => false,
}
}
@@ -379,7 +372,11 @@ impl Message {
let count = content.chars().count() as i64;
let diff = count - (constants::MESSAGE_CODE_LIMIT as i64);
- if diff > 0 { Some(diff as u64) } else { None }
+ if diff > 0 {
+ Some(diff as u64)
+ } else {
+ None
+ }
}
/// Pins this message to its channel.