Skip to content

Commit

Permalink
chore: remove cast from example
Browse files Browse the repository at this point in the history
The cast is not needed anymore as rust-lang/rust#60424
has been fixed.
  • Loading branch information
dvic committed Jan 22, 2020
1 parent e725bca commit 2b4cf6b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/dyn_reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ use warp::{http::StatusCode, Filter};

async fn dyn_reply(word: String) -> Result<Box<dyn warp::Reply>, warp::Rejection> {
if &word == "hello" {
// a cast is needed for now, see https://github.com/rust-lang/rust/issues/60424
Ok(Box::new("world") as Box<dyn warp::Reply>)
Ok(Box::new("world"))
} else {
Ok(Box::new(StatusCode::BAD_REQUEST) as Box<dyn warp::Reply>)
Ok(Box::new(StatusCode::BAD_REQUEST))
}
}

Expand Down

0 comments on commit 2b4cf6b

Please sign in to comment.