aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/emoji.rs29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/plugins/emoji.rs b/src/plugins/emoji.rs
index 99f6c26..09d5c27 100644
--- a/src/plugins/emoji.rs
+++ b/src/plugins/emoji.rs
@@ -46,7 +46,6 @@ impl Emoji {
}
fn return_emojis(&self, string: &str) -> Vec<EmojiHandle> {
-
let mut emojis: Vec<EmojiHandle> = Vec::new();
let mut current = EmojiHandle {
@@ -56,19 +55,21 @@ impl Emoji {
for c in string.chars() {
- if self.is_emoji(&c) {
- if current.symbol == c {
- current.count = current.count + 1;
-
- } else {
- if current.count > 0 {
- emojis.push(current);
- }
-
- current = EmojiHandle {
- symbol: c,
- count: 1,
- }
+ if !self.is_emoji(&c) {
+ continue;
+ }
+
+ if current.symbol == c {
+ current.count += 1;
+
+ } else {
+ if current.count > 0 {
+ emojis.push(current);
+ }
+
+ current = EmojiHandle {
+ symbol: c,
+ count: 1,
}
}
}