aboutsummaryrefslogtreecommitdiff
path: root/src/model/guild
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-07-13 18:23:41 +0200
committeracdenisSK <[email protected]>2017-07-13 18:23:41 +0200
commit1ab8b31a19c6782b867b518c01bad9fbbdd06241 (patch)
tree0926fa39bc9109e5b6f8ad7ce7c92bc6eeb25aa9 /src/model/guild
parentRemove the deprecated functions (diff)
downloadserenity-1ab8b31a19c6782b867b518c01bad9fbbdd06241.tar.xz
serenity-1ab8b31a19c6782b867b518c01bad9fbbdd06241.zip
Improve `BanOptions` to be more efficient and remove uneccessary `Read` imports
Diffstat (limited to 'src/model/guild')
-rw-r--r--src/model/guild/member.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/model/guild/member.rs b/src/model/guild/member.rs
index 2b382a0..ab817e7 100644
--- a/src/model/guild/member.rs
+++ b/src/model/guild/member.rs
@@ -18,7 +18,7 @@ use ::utils::Colour;
pub trait BanOptions {
fn dmd(&self) -> u8 { 0 }
- fn reason(&self) -> String { "".to_string() }
+ fn reason(&self) -> &str { "" }
}
impl BanOptions for u8 {
@@ -28,14 +28,14 @@ impl BanOptions for u8 {
}
impl BanOptions for str {
- fn reason(&self) -> String {
- self.to_string()
+ fn reason(&self) -> &str {
+ self
}
}
impl BanOptions for String {
- fn reason(&self) -> String {
- self.clone()
+ fn reason(&self) -> &str {
+ &self
}
}
@@ -44,8 +44,8 @@ impl<'a> BanOptions for (u8, &'a str) {
self.0
}
- fn reason(&self) -> String {
- self.1.to_string()
+ fn reason(&self) -> &str {
+ self.1
}
}
@@ -54,8 +54,8 @@ impl BanOptions for (u8, String) {
self.0
}
- fn reason(&self) -> String {
- self.1.clone()
+ fn reason(&self) -> &str {
+ &self.1
}
}