@@ -57,32 +57,6 @@ impl<T, Head, Tail: CoprodAppend<T>> CoprodAppend<T> for Coproduct<Head, Tail> {
57
57
}
58
58
}
59
59
60
- /// A hack to make `type_alias_impl_trait` work with rustdoc.
61
- ///
62
- /// When compiling under rustdoc, the left variant is used, while rustc will use the right
63
- /// variant.
64
- ///
65
- /// Tracking issue for the bug: https://github.com/rust-lang/rust/issues/65863
66
- macro_rules! doc_hack {
67
- ( $doc: expr, $not_doc: expr) => {
68
- #[ cfg( doc) ]
69
- {
70
- $doc
71
- }
72
- #[ cfg( not( doc) ) ]
73
- {
74
- $not_doc
75
- }
76
- } ;
77
-
78
- ( $doc: item $not_doc: item) => {
79
- #[ cfg( doc) ]
80
- $doc
81
- #[ cfg( not( doc) ) ]
82
- $not_doc
83
- } ;
84
- }
85
-
86
60
macro_rules! derive_clone_new_3 {
87
61
( $t: ty where $( $p: ident $( : $bound: ident ) ? ) ,+) => {
88
62
impl <$( $p $( : $bound ) ? ) ,+> Clone for $t {
@@ -159,19 +133,14 @@ where
159
133
160
134
type Error = <L as Link < Req , P > >:: Error ;
161
135
162
- doc_hack ! {
163
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
164
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
165
- }
136
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
166
137
167
138
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
168
139
let head = self . value . clone ( ) ;
169
140
170
- let fut = ( self . prev )
141
+ self . prev
171
142
. handle_link ( req, p)
172
- . map_ok ( move |( tail, p) | ( HCons { head, tail } , p) ) ;
173
-
174
- doc_hack ! { fut. boxed( ) , fut }
143
+ . map_ok ( move |( tail, p) | ( HCons { head, tail } , p) )
175
144
}
176
145
}
177
146
@@ -200,19 +169,14 @@ where
200
169
201
170
type Error = <L as Link < Req , P > >:: Error ;
202
171
203
- doc_hack ! {
204
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
205
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
206
- }
172
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
207
173
208
174
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
209
175
let rest = self . value . clone ( ) ;
210
176
211
- let fut = ( self . prev )
177
+ self . prev
212
178
. handle_link ( req, p)
213
- . map_ok ( move |( head, p) | ( head + rest, p) ) ;
214
-
215
- doc_hack ! { fut. boxed( ) , fut }
179
+ . map_ok ( move |( head, p) | ( head + rest, p) )
216
180
}
217
181
}
218
182
@@ -240,21 +204,16 @@ where
240
204
241
205
type Error = <L as Link < Req , P > >:: Error ;
242
206
243
- doc_hack ! {
244
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
245
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
246
- }
207
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
247
208
248
209
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
249
210
let next = self . next . clone ( ) ;
250
211
251
- let fut = self . prev . handle_link ( req, p) . map_ok ( move |( stack, p) | {
212
+ self . prev . handle_link ( req, p) . map_ok ( move |( stack, p) | {
252
213
let ( take, rest) = stack. sculpt ( ) ;
253
214
let merge = next ( take) ;
254
215
( rest + merge, p)
255
- } ) ;
256
-
257
- doc_hack ! { fut. boxed( ) , fut }
216
+ } )
258
217
}
259
218
}
260
219
@@ -283,22 +242,17 @@ where
283
242
284
243
type Error = Coproduct < E , <L as Link < Req , P > >:: Error > ;
285
244
286
- doc_hack ! {
287
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
288
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
289
- }
245
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
290
246
291
247
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
292
248
let next = self . next . clone ( ) ;
293
249
294
- let fut = self . prev . handle_link ( req, p) . map ( move |res| {
250
+ self . prev . handle_link ( req, p) . map ( move |res| {
295
251
let ( stack, p) = res. map_err ( Coproduct :: Inr ) ?;
296
252
let ( take, rest) = stack. sculpt ( ) ;
297
253
let merge = next ( take) . map_err ( Coproduct :: Inl ) ?;
298
254
Ok ( ( rest + merge, p) )
299
- } ) ;
300
-
301
- doc_hack ! { fut. boxed( ) , fut }
255
+ } )
302
256
}
303
257
}
304
258
@@ -328,21 +282,16 @@ where
328
282
329
283
type Error = <L as Link < Req , P > >:: Error ;
330
284
331
- doc_hack ! {
332
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
333
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
334
- }
285
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
335
286
336
287
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
337
288
let next = self . next . clone ( ) ;
338
289
339
- let fut = ( self . prev . handle_link ( req, p) ) . and_then ( |( stack, p) | async move {
290
+ ( self . prev . handle_link ( req, p) ) . and_then ( |( stack, p) | async move {
340
291
let ( take, rest) = stack. sculpt ( ) ;
341
292
let merge = next ( take) . await ;
342
293
Ok ( ( rest + merge, p) )
343
- } ) ;
344
-
345
- doc_hack ! { fut. boxed( ) , fut }
294
+ } )
346
295
}
347
296
}
348
297
@@ -373,22 +322,17 @@ where
373
322
374
323
type Error = Coproduct < E , <L as Link < Req , P > >:: Error > ;
375
324
376
- doc_hack ! {
377
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
378
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
379
- }
325
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
380
326
381
327
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
382
328
let next = self . next . clone ( ) ;
383
329
384
- let fut = self . prev . handle_link ( req, p) . then ( |res| async move {
330
+ self . prev . handle_link ( req, p) . then ( |res| async move {
385
331
let ( stack, p) = res. map_err ( Coproduct :: Inr ) ?;
386
332
let ( take, rest) = stack. sculpt ( ) ;
387
333
let merge = next ( take) . await . map_err ( Coproduct :: Inl ) ?;
388
334
Ok ( ( rest + merge, p) )
389
- } ) ;
390
-
391
- doc_hack ! { fut. boxed( ) , fut }
335
+ } )
392
336
}
393
337
}
394
338
@@ -412,17 +356,12 @@ where
412
356
413
357
type Error = E ;
414
358
415
- doc_hack ! {
416
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
417
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
418
- }
359
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
419
360
420
361
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
421
362
let next = self . next . clone ( ) ;
422
363
423
- let fut = self . prev . handle_link ( req, p) . map_err ( move |e| next ( e) ) ;
424
-
425
- doc_hack ! { fut. boxed( ) , fut }
364
+ self . prev . handle_link ( req, p) . map_err ( move |e| next ( e) )
426
365
}
427
366
}
428
367
@@ -449,20 +388,15 @@ where
449
388
450
389
type Error = Coproduct < R , <<L as Link < Req , P > >:: Error as CoprodUninjector < E , Ix > >:: Remainder > ;
451
390
452
- doc_hack ! {
453
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
454
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
455
- }
391
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
456
392
457
393
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
458
394
let next = self . next . clone ( ) ;
459
395
460
- let fut = ( self . prev . handle_link ( req, p) ) . map_err ( move |e| match e. uninject ( ) {
396
+ ( self . prev . handle_link ( req, p) ) . map_err ( move |e| match e. uninject ( ) {
461
397
Ok ( err) => Coproduct :: Inl ( next ( err) ) ,
462
398
Err ( no) => Coproduct :: Inr ( no) ,
463
- } ) ;
464
-
465
- doc_hack ! { fut. boxed( ) , fut }
399
+ } )
466
400
}
467
401
}
468
402
@@ -508,23 +442,18 @@ where
508
442
type Error =
509
443
<<L as Link < Req , P > >:: Error as CoprodAppend < <Sub as Parser < Segment > >:: Error > >:: Output ;
510
444
511
- doc_hack ! {
512
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
513
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
514
- }
445
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
515
446
516
447
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
517
- let fut = self . link . handle_link ( req, p) . map ( |res| match res {
448
+ self . link . handle_link ( req, p) . map ( |res| match res {
518
449
Ok ( ( stack, p) ) => match p. pluck ( ) {
519
450
( Ok ( ps) , rem) => Ok ( ( stack + ps, rem) ) ,
520
451
( Err ( e) , _) => Err ( <<L as Link < Req , P > >:: Error as CoprodAppend <
521
452
<Sub as Parser < Segment > >:: Error ,
522
453
> >:: appendr ( e) ) ,
523
454
} ,
524
455
Err ( e) => Err ( e. appendl ( ) ) ,
525
- } ) ;
526
-
527
- doc_hack ! { fut. boxed( ) , fut }
456
+ } )
528
457
}
529
458
}
530
459
@@ -552,20 +481,15 @@ where
552
481
553
482
type Error = <L as Link < Req , P > >:: Error ;
554
483
555
- doc_hack ! {
556
- type Future = BoxFuture <' static , Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
557
- type Future = impl Future <Output = Result <( Self :: Output , Self :: Params ) , Self :: Error >>;
558
- }
484
+ type Future = impl Future < Output = Result < ( Self :: Output , Self :: Params ) , Self :: Error > > ;
559
485
560
486
fn handle_link ( & self , req : Req , p : P ) -> Self :: Future {
561
487
let next = Arc :: clone ( & self . next ) ;
562
488
563
- let fut = self . prev . handle_link ( req, p) . and_then ( |( s, _) | async move {
489
+ self . prev . handle_link ( req, p) . and_then ( |( s, _) | async move {
564
490
let ( take, _) = s. sculpt ( ) ;
565
491
let reply = next ( take) . await ;
566
492
Ok ( ( reply. into_response ( ) , HNil ) )
567
- } ) ;
568
-
569
- doc_hack ! { fut. boxed( ) , fut }
493
+ } )
570
494
}
571
495
}
0 commit comments