File tree 2 files changed +6
-8
lines changed
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
# Unreleased
9
9
10
10
- ** added:** Implement ` From<Bytes> ` for ` Message ` ([ #3273 ] )
11
+ - ** changed:** Improved code size / compile time of ` Handler ` implementations ([ #3285 ] )
11
12
12
13
[ #3273 ] : https://github.com/tokio-rs/axum/pull/3273
14
+ [ #3285 ] : https://github.com/tokio-rs/axum/pull/3285
13
15
14
16
# 0.8.2
15
17
Original file line number Diff line number Diff line change @@ -220,27 +220,23 @@ macro_rules! impl_handler {
220
220
type Future = Pin <Box <dyn Future <Output = Response > + Send >>;
221
221
222
222
fn call( self , req: Request , state: S ) -> Self :: Future {
223
+ let ( mut parts, body) = req. into_parts( ) ;
223
224
Box :: pin( async move {
224
- let ( mut parts, body) = req. into_parts( ) ;
225
- let state = & state;
226
-
227
225
$(
228
- let $ty = match $ty:: from_request_parts( & mut parts, state) . await {
226
+ let $ty = match $ty:: from_request_parts( & mut parts, & state) . await {
229
227
Ok ( value) => value,
230
228
Err ( rejection) => return rejection. into_response( ) ,
231
229
} ;
232
230
) *
233
231
234
232
let req = Request :: from_parts( parts, body) ;
235
233
236
- let $last = match $last:: from_request( req, state) . await {
234
+ let $last = match $last:: from_request( req, & state) . await {
237
235
Ok ( value) => value,
238
236
Err ( rejection) => return rejection. into_response( ) ,
239
237
} ;
240
238
241
- let res = self ( $( $ty, ) * $last, ) . await ;
242
-
243
- res. into_response( )
239
+ self ( $( $ty, ) * $last, ) . await . into_response( )
244
240
} )
245
241
}
246
242
}
You can’t perform that action at this time.
0 commit comments