Fixed MaterialIcon display.

This commit is contained in:
Samuel Guerra 2023-08-19 00:58:40 -03:00
parent 8a7d1dbae4
commit 207f525310
1 changed files with 2 additions and 3 deletions

View File

@ -79,15 +79,14 @@ impl_from_and_into_var! {
} }
impl fmt::Display for MaterialIcon { impl fmt::Display for MaterialIcon {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut chars = self.name.chars(); let mut chars = self.name.chars().peekable();
if let Some(n) = chars.next() { if let Some(n) = chars.next() {
// skip N if followed by number. // skip N if followed by number.
if n == 'N' { if n == 'N' {
if let Some(q) = chars.next() { if let Some(q) = chars.peek() {
if !q.is_ascii_digit() { if !q.is_ascii_digit() {
write!(f, "{n}")?; write!(f, "{n}")?;
} }
write!(f, "{q}")?;
} }
} else { } else {
write!(f, "{n}")?; write!(f, "{n}")?;