Skip to content

Commit

Permalink
Remove unused mut
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Aug 22, 2023
1 parent 11b24f7 commit 24f0f3e
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions axum-extra/src/routing/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,50 +164,47 @@ mod tests {
.update(|Path(id): Path<u64>| async move { format!("users#update id={id}") })
.destroy(|Path(id): Path<u64>| async move { format!("users#destroy id={id}") });

let mut app = Router::new().merge(users);
let app = Router::new().merge(users);

assert_eq!(
call_route(&mut app, Method::GET, "/users").await,
"users#index"
);
assert_eq!(call_route(&app, Method::GET, "/users").await, "users#index");

assert_eq!(
call_route(&mut app, Method::POST, "/users").await,
call_route(&app, Method::POST, "/users").await,
"users#create"
);

assert_eq!(
call_route(&mut app, Method::GET, "/users/new").await,
call_route(&app, Method::GET, "/users/new").await,
"users#new"
);

assert_eq!(
call_route(&mut app, Method::GET, "/users/1").await,
call_route(&app, Method::GET, "/users/1").await,
"users#show id=1"
);

assert_eq!(
call_route(&mut app, Method::GET, "/users/1/edit").await,
call_route(&app, Method::GET, "/users/1/edit").await,
"users#edit id=1"
);

assert_eq!(
call_route(&mut app, Method::PATCH, "/users/1").await,
call_route(&app, Method::PATCH, "/users/1").await,
"users#update id=1"
);

assert_eq!(
call_route(&mut app, Method::PUT, "/users/1").await,
call_route(&app, Method::PUT, "/users/1").await,
"users#update id=1"
);

assert_eq!(
call_route(&mut app, Method::DELETE, "/users/1").await,
call_route(&app, Method::DELETE, "/users/1").await,
"users#destroy id=1"
);
}

async fn call_route(app: &mut Router, method: Method, uri: &str) -> String {
async fn call_route(app: &Router, method: Method, uri: &str) -> String {
let res = app
.clone()
.oneshot(
Expand Down

0 comments on commit 24f0f3e

Please sign in to comment.