@@ -290,24 +290,20 @@ impl Body for Incoming {
290290 any( feature = "http1" , feature = "http2" ) ,
291291 any( feature = "client" , feature = "server" )
292292 ) ) ]
293- macro_rules! opt_len {
294- ( $content_length: expr) => { {
295- let mut hint = SizeHint :: default ( ) ;
296-
297- if let Some ( content_length) = $content_length. into_opt( ) {
298- hint. set_exact( content_length) ;
299- }
300-
301- hint
302- } } ;
293+ fn opt_len ( decoded_length : DecodedLength ) -> SizeHint {
294+ if let Some ( content_length) = decoded_length. into_opt ( ) {
295+ SizeHint :: with_exact ( content_length)
296+ } else {
297+ SizeHint :: default ( )
298+ }
303299 }
304300
305301 match self . kind {
306302 Kind :: Empty => SizeHint :: with_exact ( 0 ) ,
307303 #[ cfg( all( feature = "http1" , any( feature = "client" , feature = "server" ) ) ) ]
308- Kind :: Chan { content_length, .. } => opt_len ! ( content_length) ,
304+ Kind :: Chan { content_length, .. } => opt_len ( content_length) ,
309305 #[ cfg( all( feature = "http2" , any( feature = "client" , feature = "server" ) ) ) ]
310- Kind :: H2 { content_length, .. } => opt_len ! ( content_length) ,
306+ Kind :: H2 { content_length, .. } => opt_len ( content_length) ,
311307 #[ cfg( feature = "ffi" ) ]
312308 Kind :: Ffi ( ..) => SizeHint :: default ( ) ,
313309 }
0 commit comments