Skip to content

Commit

Permalink
Fix todos example and ws test compilation error
Browse files Browse the repository at this point in the history
- Per Sean McArthur's suggestion here - #1020 (comment)
- Fixes #1015
  • Loading branch information
baum authored and seanmonstar committed Mar 20, 2023
1 parent 4e9c4fd commit 97cfe64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions examples/todos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mod filters {
/// The 4 TODOs filters combined.
pub fn todos(
db: Db,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone {
todos_list(db.clone())
.or(todos_create(db.clone()))
.or(todos_update(db.clone()))
Expand All @@ -48,7 +48,7 @@ mod filters {
/// GET /todos?offset=3&limit=5
pub fn todos_list(
db: Db,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone {
warp::path!("todos")
.and(warp::get())
.and(warp::query::<ListOptions>())
Expand All @@ -59,7 +59,7 @@ mod filters {
/// POST /todos with JSON body
pub fn todos_create(
db: Db,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone {
warp::path!("todos")
.and(warp::post())
.and(json_body())
Expand All @@ -70,7 +70,7 @@ mod filters {
/// PUT /todos/:id with JSON body
pub fn todos_update(
db: Db,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone {
warp::path!("todos" / u64)
.and(warp::put())
.and(json_body())
Expand All @@ -81,7 +81,7 @@ mod filters {
/// DELETE /todos/:id
pub fn todos_delete(
db: Db,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + 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");

Expand Down
2 changes: 1 addition & 1 deletion tests/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async fn ws_with_query() {
}

// Websocket filter that echoes all messages back.
fn ws_echo() -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Copy {
fn ws_echo() -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Copy {
warp::ws().map(|ws: warp::ws::Ws| {
ws.on_upgrade(|websocket| {
// Just echo all messages back...
Expand Down

0 comments on commit 97cfe64

Please sign in to comment.