@@ -290,24 +290,20 @@ impl Body for Incoming {
290
290
any( feature = "http1" , feature = "http2" ) ,
291
291
any( feature = "client" , feature = "server" )
292
292
) ) ]
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
+ }
303
299
}
304
300
305
301
match self . kind {
306
302
Kind :: Empty => SizeHint :: with_exact ( 0 ) ,
307
303
#[ 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) ,
309
305
#[ 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) ,
311
307
#[ cfg( feature = "ffi" ) ]
312
308
Kind :: Ffi ( ..) => SizeHint :: default ( ) ,
313
309
}
0 commit comments