delete needless return
@@ -2,10 +2,10 @@ use http_types::{Method, StatusCode, Url};
use tide::{http, Request};
async fn add_one(cx: Request<()>) -> Result<String, tide::Error> {
- return match cx.param::<i64>("num") {
+ match cx.param::<i64>("num") {
Ok(num) => Ok((num + 1).to_string()),
Err(err) => Err(tide::Error::new(StatusCode::BadRequest, err)),
- };
+ }
}
async fn add_two(cx: Request<()>) -> Result<String, tide::Error> {
@@ -23,17 +23,17 @@ async fn add_two(cx: Request<()>) -> Result<String, tide::Error> {
}
async fn echo_path(cx: Request<()>) -> Result<String, tide::Error> {
- return match cx.param::<String>("path") {
+ match cx.param::<String>("path") {
Ok(path) => Ok(path),
Err(err) => Err(tide::Error::new(StatusCode::BadRequest, err)),
- };
+ }
}
async fn echo_empty(cx: Request<()>) -> Result<String, tide::Error> {
- return match cx.param::<String>("") {
+ match cx.param::<String>("") {
Ok(path) => Ok(path),
Err(err) => Err(tide::Error::new(StatusCode::BadRequest, err)),
- };
+ }
}
#[async_std::test]
