aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/message.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-08-18 16:14:32 -0700
committerZeyla Hellyer <[email protected]>2017-08-18 17:52:53 -0700
commite4113570967a1fb13539efbfa2cf7285b19d95ba (patch)
tree06bb020fcfaa5f8323454dfb525272314a900186 /src/model/channel/message.rs
parentMove Clippy lints to a cfg_attr (diff)
downloadserenity-e4113570967a1fb13539efbfa2cf7285b19d95ba.tar.xz
serenity-e4113570967a1fb13539efbfa2cf7285b19d95ba.zip
Apply rustfmt
Diffstat (limited to 'src/model/channel/message.rs')
-rw-r--r--src/model/channel/message.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 6fdab2a..fb8fbaa 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -290,9 +290,10 @@ 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
@@ -318,8 +319,12 @@ 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.
@@ -332,8 +337,9 @@ 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
@@ -353,7 +359,8 @@ 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,
}
}
@@ -370,11 +377,7 @@ 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.