@@ -4,9 +4,8 @@ use std::fmt;
44#[ cfg( all( feature = "model" , feature = "utils" ) ) ]
55use std:: str:: FromStr ;
66
7- use to_arraystring:: ToArrayString ;
8-
97use super :: prelude:: * ;
8+ use crate :: internal:: prelude:: * ;
109#[ cfg( all( feature = "model" , feature = "utils" ) ) ]
1110use crate :: utils;
1211
@@ -113,19 +112,16 @@ impl fmt::Display for Mention {
113112}
114113
115114impl ToArrayString for Mention {
116- type ArrayString = arrayvec:: ArrayString < { 20 + 4 } > ;
115+ const MAX_LENGTH : usize = 20 + 4 ;
116+ type ArrayString = ArrayString < { 20 + 4 } > ;
117117
118118 fn to_arraystring ( self ) -> Self :: ArrayString {
119- let ( prefix, id) = match self {
120- Self :: Channel ( id) => ( "<#" , id. get ( ) ) ,
121- Self :: Role ( id) => ( "<@&" , id. get ( ) ) ,
122- Self :: User ( id) => ( "<@" , id. get ( ) ) ,
123- } ;
124-
125119 let mut out = Self :: ArrayString :: new ( ) ;
126- out. push_str ( prefix) ;
127- out. push_str ( & id. to_arraystring ( ) ) ;
128- out. push ( '>' ) ;
120+ match self {
121+ Self :: Channel ( id) => aformat_into ! ( out, "<#{id}>" ) ,
122+ Self :: Role ( id) => aformat_into ! ( out, "<@&{id}>" ) ,
123+ Self :: User ( id) => aformat_into ! ( out, "<@{id}>" ) ,
124+ } ;
129125
130126 out
131127 }
0 commit comments