diff --git a/actix-http/src/header/map.rs b/actix-http/src/header/map.rs index 6da01d2c0..7be282b11 100644 --- a/actix-http/src/header/map.rs +++ b/actix-http/src/header/map.rs @@ -830,7 +830,7 @@ impl<'a> Drain<'a> { } } -impl<'a> Iterator for Drain<'a> { +impl Iterator for Drain<'_> { type Item = (Option, HeaderValue); fn next(&mut self) -> Option { diff --git a/actix-http/src/helpers.rs b/actix-http/src/helpers.rs index 7f28018e7..61175bdc9 100644 --- a/actix-http/src/helpers.rs +++ b/actix-http/src/helpers.rs @@ -61,7 +61,7 @@ pub fn write_content_length(n: u64, buf: &mut B, camel_case: bool) { /// perform a remaining length check before writing. pub(crate) struct MutWriter<'a, B>(pub(crate) &'a mut B); -impl<'a, B> io::Write for MutWriter<'a, B> +impl io::Write for MutWriter<'_, B> where B: BufMut, { diff --git a/actix-http/src/http_message.rs b/actix-http/src/http_message.rs index 3ba9ef752..2800f40ba 100644 --- a/actix-http/src/http_message.rs +++ b/actix-http/src/http_message.rs @@ -103,7 +103,7 @@ pub trait HttpMessage: Sized { } } -impl<'a, T> HttpMessage for &'a mut T +impl HttpMessage for &mut T where T: HttpMessage, { diff --git a/actix-router/src/resource_path.rs b/actix-router/src/resource_path.rs index 45948aa2a..610dc344d 100644 --- a/actix-router/src/resource_path.rs +++ b/actix-router/src/resource_path.rs @@ -19,7 +19,7 @@ impl ResourcePath for String { } } -impl<'a> ResourcePath for &'a str { +impl ResourcePath for &str { fn path(&self) -> &str { self } diff --git a/actix-web-codegen/tests/routes.rs b/actix-web-codegen/tests/routes.rs index a6e606871..1443f9a75 100644 --- a/actix-web-codegen/tests/routes.rs +++ b/actix-web-codegen/tests/routes.rs @@ -136,7 +136,7 @@ async fn routes_overlapping_inaccessible_test(req: HttpRequest) -> impl Responde } #[get("/custom_resource_name", name = "custom")] -async fn custom_resource_name_test<'a>(req: HttpRequest) -> impl Responder { +async fn custom_resource_name_test(req: HttpRequest) -> impl Responder { assert!(req.url_for_static("custom").is_ok()); assert!(req.url_for_static("custom_resource_name_test").is_err()); HttpResponse::Ok() diff --git a/actix-web/src/helpers.rs b/actix-web/src/helpers.rs index 1d2679fce..c7b33a083 100644 --- a/actix-web/src/helpers.rs +++ b/actix-web/src/helpers.rs @@ -10,7 +10,7 @@ use bytes::BufMut; /// perform a remaining length check before writing. pub(crate) struct MutWriter<'a, B>(pub(crate) &'a mut B); -impl<'a, B> io::Write for MutWriter<'a, B> +impl io::Write for MutWriter<'_, B> where B: BufMut, { diff --git a/actix-web/src/middleware/logger.rs b/actix-web/src/middleware/logger.rs index 21986baae..125925603 100644 --- a/actix-web/src/middleware/logger.rs +++ b/actix-web/src/middleware/logger.rs @@ -704,7 +704,7 @@ impl FormatText { /// Converter to get a String from something that writes to a Formatter. pub(crate) struct FormatDisplay<'a>(&'a dyn Fn(&mut fmt::Formatter<'_>) -> Result<(), fmt::Error>); -impl<'a> fmt::Display for FormatDisplay<'a> { +impl fmt::Display for FormatDisplay<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { (self.0)(fmt) } diff --git a/actix-web/src/types/json.rs b/actix-web/src/types/json.rs index 51a322e43..22ed624c3 100644 --- a/actix-web/src/types/json.rs +++ b/actix-web/src/types/json.rs @@ -332,7 +332,7 @@ impl JsonBody { (true, Ok(Some(mime))) => { mime.subtype() == mime::JSON || mime.suffix() == Some(mime::JSON) - || ctype_fn.map_or(false, |predicate| predicate(mime)) + || ctype_fn.is_some_and(|predicate| predicate(mime)) } // if content-type is expected but not parsable as mime type, bail diff --git a/awc/src/client/connector.rs b/awc/src/client/connector.rs index f3d443070..15dc34557 100644 --- a/awc/src/client/connector.rs +++ b/awc/src/client/connector.rs @@ -511,7 +511,8 @@ where let h2 = sock .ssl() .selected_alpn_protocol() - .map_or(false, |protos| protos.windows(2).any(|w| w == H2)); + .is_some_and(|protos| protos.windows(2).any(|w| w == H2)); + if h2 { (Box::new(sock), Protocol::Http2) } else { @@ -550,7 +551,8 @@ where .get_ref() .1 .alpn_protocol() - .map_or(false, |protos| protos.windows(2).any(|w| w == H2)); + .is_some_and(|protos| protos.windows(2).any(|w| w == H2)); + if h2 { (Box::new(sock), Protocol::Http2) } else { @@ -584,7 +586,8 @@ where .get_ref() .1 .alpn_protocol() - .map_or(false, |protos| protos.windows(2).any(|w| w == H2)); + .is_some_and(|protos| protos.windows(2).any(|w| w == H2)); + if h2 { (Box::new(sock), Protocol::Http2) } else { @@ -621,7 +624,8 @@ where .get_ref() .1 .alpn_protocol() - .map_or(false, |protos| protos.windows(2).any(|w| w == H2)); + .is_some_and(|protos| protos.windows(2).any(|w| w == H2)); + if h2 { (Box::new(sock), Protocol::Http2) } else { @@ -655,7 +659,8 @@ where .get_ref() .1 .alpn_protocol() - .map_or(false, |protos| protos.windows(2).any(|w| w == H2)); + .is_some_and(|protos| protos.windows(2).any(|w| w == H2)); + if h2 { (Box::new(sock), Protocol::Http2) } else { diff --git a/awc/src/ws.rs b/awc/src/ws.rs index 760331e9d..b05063d22 100644 --- a/awc/src/ws.rs +++ b/awc/src/ws.rs @@ -444,7 +444,7 @@ struct Host<'a> { port: Option>, } -impl<'a> fmt::Display for Host<'a> { +impl fmt::Display for Host<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.hostname)?;