@@ -238,12 +238,11 @@ where
238
238
}
239
239
}
240
240
241
- #[ cfg( impl_trait_available) ]
242
- pub ( crate ) fn send_request_retryable ( & mut self , req : Request < B > ) -> impl Future < Item = Response < Body > , Error = ( :: Error , Option < Request < B > > ) > + Send
241
+ pub ( crate ) fn send_request_retryable ( & mut self , req : Request < B > ) -> impl_trait ! ( ty: Future <Item = Response <Body >, Error = ( :: Error , Option <Request <B >>) > + Send )
243
242
where
244
243
B : Send ,
245
244
{
246
- match self . dispatch . try_send ( req) {
245
+ impl_trait ! ( e : match self . dispatch. try_send( req) {
247
246
Ok ( rx) => {
248
247
Either :: A ( rx. then( move |res| {
249
248
match res {
@@ -259,32 +258,7 @@ where
259
258
let err = :: Error :: new_canceled( Some ( "connection was not ready" ) ) ;
260
259
Either :: B ( future:: err( ( err, Some ( req) ) ) )
261
260
}
262
- }
263
- }
264
-
265
- #[ cfg( not( impl_trait_available) ) ]
266
- pub ( super ) fn send_request_retryable ( & mut self , req : Request < B > ) -> Box < Future < Item =Response < Body > , Error =( :: Error , Option < Request < B > > ) > + Send >
267
- where
268
- B : Send ,
269
- {
270
- let inner = match self . dispatch . try_send ( req) {
271
- Ok ( rx) => {
272
- Either :: A ( rx. then ( move |res| {
273
- match res {
274
- Ok ( Ok ( res) ) => Ok ( res) ,
275
- Ok ( Err ( err) ) => Err ( err) ,
276
- // this is definite bug if it happens, but it shouldn't happen!
277
- Err ( _) => panic ! ( "dispatch dropped without returning error" ) ,
278
- }
279
- } ) )
280
- } ,
281
- Err ( req) => {
282
- debug ! ( "connection was not ready" ) ;
283
- let err = :: Error :: new_canceled ( Some ( "connection was not ready" ) ) ;
284
- Either :: B ( future:: err ( ( err, Some ( req) ) ) )
285
- }
286
- } ;
287
- Box :: new ( inner)
261
+ } )
288
262
}
289
263
}
290
264
@@ -324,12 +298,11 @@ impl<B> Http2SendRequest<B>
324
298
where
325
299
B : Payload + ' static ,
326
300
{
327
- #[ cfg( impl_trait_available) ]
328
- pub ( super ) fn send_request_retryable ( & mut self , req : Request < B > ) -> impl Future < Item =Response < Body > , Error =( :: Error , Option < Request < B > > ) > + Send
301
+ pub ( super ) fn send_request_retryable ( & mut self , req : Request < B > ) -> impl_trait ! ( ty: Future <Item =Response <Body >, Error =( :: Error , Option <Request <B >>) > + Send )
329
302
where
330
303
B : Send ,
331
304
{
332
- match self . dispatch . try_send ( req) {
305
+ impl_trait ! ( e : match self . dispatch. try_send( req) {
333
306
Ok ( rx) => {
334
307
Either :: A ( rx. then( move |res| {
335
308
match res {
@@ -345,32 +318,7 @@ where
345
318
let err = :: Error :: new_canceled( Some ( "connection was not ready" ) ) ;
346
319
Either :: B ( future:: err( ( err, Some ( req) ) ) )
347
320
}
348
- }
349
- }
350
-
351
- #[ cfg( not( impl_trait_available) ) ]
352
- pub ( crate ) fn send_request_retryable ( & mut self , req : Request < B > ) -> Box < Future < Item =Response < Body > , Error =( :: Error , Option < Request < B > > ) > + Send >
353
- where
354
- B : Send ,
355
- {
356
- let inner = match self . dispatch . try_send ( req) {
357
- Ok ( rx) => {
358
- Either :: A ( rx. then ( move |res| {
359
- match res {
360
- Ok ( Ok ( res) ) => Ok ( res) ,
361
- Ok ( Err ( err) ) => Err ( err) ,
362
- // this is definite bug if it happens, but it shouldn't happen!
363
- Err ( _) => panic ! ( "dispatch dropped without returning error" ) ,
364
- }
365
- } ) )
366
- } ,
367
- Err ( req) => {
368
- debug ! ( "connection was not ready" ) ;
369
- let err = :: Error :: new_canceled ( Some ( "connection was not ready" ) ) ;
370
- Either :: B ( future:: err ( ( err, Some ( req) ) ) )
371
- }
372
- } ;
373
- Box :: new ( inner)
321
+ } )
374
322
}
375
323
}
376
324
0 commit comments