File tree Expand file tree Collapse file tree 2 files changed +3
-30
lines changed Expand file tree Collapse file tree 2 files changed +3
-30
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ encoding_rs = "0.8"
2222[dependencies ]
2323cssparser-macros = {path = " ./macros" , version = " 0.6" }
2424dtoa-short = " 0.3"
25- itoa = " 0.4 "
25+ itoa = " 1.0 "
2626matches = " 0.1"
2727phf = {version = " 0.10" , features = [" macros" ]}
2828serde = {version = " 1.0" , optional = true }
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ use dtoa_short::{self, Notation};
66use itoa;
77use matches:: matches;
88use std:: fmt:: { self , Write } ;
9- use std:: io;
109use std:: str;
1110
1211use super :: Token ;
@@ -342,34 +341,8 @@ macro_rules! impl_tocss_for_int {
342341 where
343342 W : fmt:: Write ,
344343 {
345- struct AssumeUtf8 <W : fmt:: Write >( W ) ;
346-
347- impl <W : fmt:: Write > io:: Write for AssumeUtf8 <W > {
348- #[ inline]
349- fn write_all( & mut self , buf: & [ u8 ] ) -> io:: Result <( ) > {
350- // Safety: itoa only emits ASCII, which is also well-formed UTF-8.
351- debug_assert!( buf. is_ascii( ) ) ;
352- self . 0
353- . write_str( unsafe { str :: from_utf8_unchecked( buf) } )
354- . map_err( |_| io:: ErrorKind :: Other . into( ) )
355- }
356-
357- #[ inline]
358- fn write( & mut self , buf: & [ u8 ] ) -> io:: Result <usize > {
359- self . write_all( buf) ?;
360- Ok ( buf. len( ) )
361- }
362-
363- #[ inline]
364- fn flush( & mut self ) -> io:: Result <( ) > {
365- Ok ( ( ) )
366- }
367- }
368-
369- match itoa:: write( AssumeUtf8 ( dest) , * self ) {
370- Ok ( _) => Ok ( ( ) ) ,
371- Err ( _) => Err ( fmt:: Error ) ,
372- }
344+ let mut buf = itoa:: Buffer :: new( ) ;
345+ dest. write_str( buf. format( * self ) )
373346 }
374347 }
375348 } ;
You can’t perform that action at this time.
0 commit comments