Skip to content

Commit eff2b92

Browse files
committed
Remove emoji display helpers
1 parent 2c5569f commit eff2b92

1 file changed

Lines changed: 0 additions & 57 deletions

File tree

src/models/emoji.rs

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,6 @@ wire_enum!(EmojiType, u8, Unknown, {
2323
Custom = 2,
2424
});
2525

26-
impl EmojiType {
27-
/// Returns a human-readable description of the emoji type.
28-
pub fn description(&self) -> &'static str {
29-
match self {
30-
EmojiType::System => "System emoji",
31-
EmojiType::Custom => "Custom emoji",
32-
EmojiType::Unknown(_) => "Unknown emoji type",
33-
}
34-
}
35-
}
36-
37-
impl std::fmt::Display for EmojiType {
38-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39-
write!(f, "{}", self.description())
40-
}
41-
}
42-
4326
/// Represents an emoji used in reactions or messages.
4427
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4528
pub struct Emoji {
@@ -62,16 +45,6 @@ impl HasId for Emoji {
6245
}
6346
}
6447

65-
impl std::fmt::Display for Emoji {
66-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
67-
if let Some(name) = &self.name {
68-
write!(f, ":{}: ({})", name, self.emoji_type)
69-
} else {
70-
write!(f, "Emoji {} ({})", self.id, self.emoji_type)
71-
}
72-
}
73-
}
74-
7548
#[cfg(test)]
7649
mod tests {
7750
use super::*;
@@ -87,13 +60,6 @@ mod tests {
8760
assert_eq!(u8::from(EmojiType::Unknown(99)), 99);
8861
}
8962

90-
#[test]
91-
fn test_emoji_type_description() {
92-
assert_eq!(EmojiType::System.description(), "System emoji");
93-
assert_eq!(EmojiType::Custom.description(), "Custom emoji");
94-
assert_eq!(EmojiType::Unknown(5).description(), "Unknown emoji type");
95-
}
96-
9763
#[test]
9864
fn emoji_omits_absent_metadata_like_official_dto() {
9965
let emoji = Emoji {
@@ -137,27 +103,4 @@ mod tests {
137103
};
138104
assert_eq!(emoji.id(), Some(&"test_id".to_string()));
139105
}
140-
141-
#[test]
142-
fn test_emoji_display() {
143-
let named_emoji = Emoji {
144-
id: "123".to_string(),
145-
emoji_type: EmojiType::Custom,
146-
name: Some("happy".to_string()),
147-
url: None,
148-
};
149-
let display = format!("{}", named_emoji);
150-
assert!(display.contains(":happy:"));
151-
assert!(display.contains("Custom emoji"));
152-
153-
let unnamed_emoji = Emoji {
154-
id: "456".to_string(),
155-
emoji_type: EmojiType::System,
156-
name: None,
157-
url: None,
158-
};
159-
let display = format!("{}", unnamed_emoji);
160-
assert!(display.contains("Emoji 456"));
161-
assert!(display.contains("System emoji"));
162-
}
163106
}

0 commit comments

Comments
 (0)