mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-28 15:30:16 +01:00
Remove one clone
This commit is contained in:
parent
e66be09d59
commit
092719c217
2 changed files with 5 additions and 5 deletions
|
@ -656,14 +656,14 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn call_with_state(&mut self, req: Request, state: S) -> RouteFuture<E> {
|
||||
fn call_with_state(self, req: Request, state: S) -> RouteFuture<E> {
|
||||
match self {
|
||||
Fallback::Default(route) | Fallback::Service(route) => {
|
||||
RouteFuture::from_future(route.oneshot_inner(req))
|
||||
RouteFuture::from_future(route.oneshot_inner_owned(req))
|
||||
}
|
||||
Fallback::BoxedHandler(handler) => {
|
||||
let mut route = handler.clone().into_route(state);
|
||||
RouteFuture::from_future(route.oneshot_inner(req))
|
||||
let route = handler.clone().into_route(state);
|
||||
RouteFuture::from_future(route.oneshot_inner_owned(req))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -344,5 +344,5 @@ async fn state_isnt_cloned_too_much_with_fallback() {
|
|||
|
||||
client.get("/does-not-exist").await;
|
||||
|
||||
assert_eq!(state.count(), 4);
|
||||
assert_eq!(state.count(), 3);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue