mirror of
https://github.com/tokio-rs/axum.git
synced 2025-10-01 15:00:46 +00:00
remove one clone
This commit is contained in:
parent
11fe5c737c
commit
9feb526c03
@ -668,12 +668,12 @@ 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 {
|
match self {
|
||||||
Fallback::Default(route) | Fallback::Service(route) => route.oneshot_inner(req),
|
Fallback::Default(route) | Fallback::Service(route) => route.oneshot_inner_owned(req),
|
||||||
Fallback::BoxedHandler(handler) => {
|
Fallback::BoxedHandler(handler) => {
|
||||||
let mut route = handler.clone().into_route(state);
|
let route = handler.clone().into_route(state);
|
||||||
route.oneshot_inner(req)
|
route.oneshot_inner_owned(req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,5 +344,5 @@ async fn state_isnt_cloned_too_much_with_fallback() {
|
|||||||
|
|
||||||
client.get("/does-not-exist").await;
|
client.get("/does-not-exist").await;
|
||||||
|
|
||||||
assert_eq!(state.count(), 4);
|
assert_eq!(state.count(), 3);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user