From 4b6ffdf4585c0a51513d8feda6520fffe22b5157 Mon Sep 17 00:00:00 2001 From: Alexander Indenbaum Date: Mon, 20 Mar 2023 15:04:30 +0200 Subject: [PATCH] Fix todos example and ws test compilation error - Per Sean McArthur's suggestion here - https://github.com/seanmonstar/warp/pull/1020#issuecomment-1419535610 - Fixes https://github.com/seanmonstar/warp/issues/1015 --- examples/todos.rs | 10 +++++----- tests/ws.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/todos.rs b/examples/todos.rs index 904d604e8..ee5c3865a 100644 --- a/examples/todos.rs +++ b/examples/todos.rs @@ -38,7 +38,7 @@ mod filters { /// The 4 TODOs filters combined. pub fn todos( db: Db, - ) -> impl Filter + Clone { + ) -> impl Filter + Clone { todos_list(db.clone()) .or(todos_create(db.clone())) .or(todos_update(db.clone())) @@ -48,7 +48,7 @@ mod filters { /// GET /todos?offset=3&limit=5 pub fn todos_list( db: Db, - ) -> impl Filter + Clone { + ) -> impl Filter + Clone { warp::path!("todos") .and(warp::get()) .and(warp::query::()) @@ -59,7 +59,7 @@ mod filters { /// POST /todos with JSON body pub fn todos_create( db: Db, - ) -> impl Filter + Clone { + ) -> impl Filter + Clone { warp::path!("todos") .and(warp::post()) .and(json_body()) @@ -70,7 +70,7 @@ mod filters { /// PUT /todos/:id with JSON body pub fn todos_update( db: Db, - ) -> impl Filter + Clone { + ) -> impl Filter + Clone { warp::path!("todos" / u64) .and(warp::put()) .and(json_body()) @@ -81,7 +81,7 @@ mod filters { /// DELETE /todos/:id pub fn todos_delete( db: Db, - ) -> impl Filter + Clone { + ) -> impl Filter + Clone { // We'll make one of our endpoints admin-only to show how authentication filters are used let admin_only = warp::header::exact("authorization", "Bearer admin"); diff --git a/tests/ws.rs b/tests/ws.rs index d5b60356e..4e57e7f70 100644 --- a/tests/ws.rs +++ b/tests/ws.rs @@ -275,7 +275,7 @@ async fn ws_with_query() { } // Websocket filter that echoes all messages back. -fn ws_echo() -> impl Filter + Copy { +fn ws_echo() -> impl Filter + Copy { warp::ws().map(|ws: warp::ws::Ws| { ws.on_upgrade(|websocket| { // Just echo all messages back...