From 5fa564fd4e6ddbfe6202faaca4c3360fbcd14cc5 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 13 Mar 2023 17:59:23 +0000 Subject: [PATCH] clippy --- examples/errors/src/helpers.rs | 8 ++++---- examples/url-dispatch/src/url_ext.rs | 2 +- examples/url-dispatch/src/urls.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/errors/src/helpers.rs b/examples/errors/src/helpers.rs index a735075..97e60f4 100644 --- a/examples/errors/src/helpers.rs +++ b/examples/errors/src/helpers.rs @@ -1,5 +1,5 @@ // -use actix_web::{error, get, App, HttpServer, Result}; +use actix_web::{error, get, App, HttpServer}; #[derive(Debug)] struct MyError { @@ -7,10 +7,10 @@ struct MyError { } #[get("/")] -async fn index() -> Result<&'static str> { - let result: Result<&'static str, MyError> = Err(MyError { name: "test error" }); +async fn index() -> actix_web::Result { + let result = Err(MyError { name: "test error" }); - Ok(result.map_err(|e| error::ErrorBadRequest(e.name))?) + result.map_err(|err| error::ErrorBadRequest(err.name)) } // diff --git a/examples/url-dispatch/src/url_ext.rs b/examples/url-dispatch/src/url_ext.rs index 9eb7647..ca93724 100644 --- a/examples/url-dispatch/src/url_ext.rs +++ b/examples/url-dispatch/src/url_ext.rs @@ -3,7 +3,7 @@ use actix_web::{get, App, HttpRequest, HttpServer, Responder}; #[get("/")] async fn index(req: HttpRequest) -> impl Responder { - let url = req.url_for("youtube", &["oHg5SJYRHA0"]).unwrap(); + let url = req.url_for("youtube", ["oHg5SJYRHA0"]).unwrap(); assert_eq!(url.as_str(), "https://youtube.com/watch/oHg5SJYRHA0"); url.to_string() diff --git a/examples/url-dispatch/src/urls.rs b/examples/url-dispatch/src/urls.rs index 7ce357f..12ef0eb 100644 --- a/examples/url-dispatch/src/urls.rs +++ b/examples/url-dispatch/src/urls.rs @@ -3,7 +3,7 @@ use actix_web::{get, guard, http::header, HttpRequest, HttpResponse, Result}; #[get("/test/")] async fn index(req: HttpRequest) -> Result { - let url = req.url_for("foo", &["1", "2", "3"])?; // <- generate url for "foo" resource + let url = req.url_for("foo", ["1", "2", "3"])?; // <- generate url for "foo" resource Ok(HttpResponse::Found() .insert_header((header::LOCATION, url.as_str()))