Skip to content

Commit 9feb526

Browse files
novacrazyyanns
authored andcommitted
remove one clone
1 parent 11fe5c7 commit 9feb526

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

axum/src/routing/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,12 @@ where
668668
}
669669
}
670670

671-
fn call_with_state(&mut self, req: Request, state: S) -> RouteFuture<E> {
671+
fn call_with_state(self, req: Request, state: S) -> RouteFuture<E> {
672672
match self {
673-
Fallback::Default(route) | Fallback::Service(route) => route.oneshot_inner(req),
673+
Fallback::Default(route) | Fallback::Service(route) => route.oneshot_inner_owned(req),
674674
Fallback::BoxedHandler(handler) => {
675-
let mut route = handler.clone().into_route(state);
676-
route.oneshot_inner(req)
675+
let route = handler.clone().into_route(state);
676+
route.oneshot_inner_owned(req)
677677
}
678678
}
679679
}

axum/src/routing/tests/fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,5 +344,5 @@ async fn state_isnt_cloned_too_much_with_fallback() {
344344

345345
client.get("/does-not-exist").await;
346346

347-
assert_eq!(state.count(), 4);
347+
assert_eq!(state.count(), 3);
348348
}

0 commit comments

Comments
 (0)