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