File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1- use bytes:: { Bytes , BytesMut } ;
1+ use bytes:: Bytes ;
22
33use std:: convert:: TryFrom ;
44use std:: error:: Error ;
5- use std:: fmt:: Write ;
65use std:: hash:: { Hash , Hasher } ;
76use std:: str:: FromStr ;
87use std:: { cmp, fmt, str} ;
@@ -396,10 +395,10 @@ macro_rules! from_integers {
396395 ( $( $name: ident: $t: ident => $max_len: expr) ,* ) => { $(
397396 impl From <$t> for HeaderValue {
398397 fn from( num: $t) -> HeaderValue {
399- let mut buf = BytesMut :: with_capacity ( $max_len ) ;
400- let _ = buf. write_str ( :: itoa :: Buffer :: new ( ) . format( num) ) ;
398+ let mut buf = :: itoa :: Buffer :: new ( ) ;
399+ let s = buf. format( num) ;
401400 HeaderValue {
402- inner: buf . freeze ( ) ,
401+ inner: Bytes :: copy_from_slice ( s . as_bytes ( ) ) ,
403402 is_sensitive: false ,
404403 }
405404 }
You can’t perform that action at this time.
0 commit comments