diff --git a/poem-grpc/src/metadata.rs b/poem-grpc/src/metadata.rs index 9ecb68f333..fe72114ecb 100644 --- a/poem-grpc/src/metadata.rs +++ b/poem-grpc/src/metadata.rs @@ -168,7 +168,7 @@ pub struct GetBinaryAll<'a> { iter: poem::http::header::ValueIter<'a, HeaderValue>, } -impl<'a> Iterator for GetBinaryAll<'a> { +impl Iterator for GetBinaryAll<'_> { type Item = Vec; fn next(&mut self) -> Option { diff --git a/poem-openapi/src/payload/base64_payload.rs b/poem-openapi/src/payload/base64_payload.rs index 4ee10c3ff6..1fa489057d 100644 --- a/poem-openapi/src/payload/base64_payload.rs +++ b/poem-openapi/src/payload/base64_payload.rs @@ -93,7 +93,7 @@ impl Payload for Base64 { && (content_type.subtype() == "plain" || content_type .suffix() - .map_or(false, |v| v == "plain"))) + .is_some_and(|v| v == "plain"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/binary.rs b/poem-openapi/src/payload/binary.rs index 1932d0de02..609c34ceff 100644 --- a/poem-openapi/src/payload/binary.rs +++ b/poem-openapi/src/payload/binary.rs @@ -92,7 +92,7 @@ impl Payload for Binary { && (content_type.subtype() == "octet-stream" || content_type .suffix() - .map_or(false, |v| v == "octet-stream"))) + .is_some_and(|v| v == "octet-stream"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/form.rs b/poem-openapi/src/payload/form.rs index 2464989064..b06a43cbd3 100644 --- a/poem-openapi/src/payload/form.rs +++ b/poem-openapi/src/payload/form.rs @@ -36,7 +36,7 @@ impl Payload for Form { && (content_type.subtype() == "x-www-form-urlencoded" || content_type .suffix() - .map_or(false, |v| v == "x-www-form-urlencoded"))) + .is_some_and(|v| v == "x-www-form-urlencoded"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/html.rs b/poem-openapi/src/payload/html.rs index ed32d9402e..d501917fe9 100644 --- a/poem-openapi/src/payload/html.rs +++ b/poem-openapi/src/payload/html.rs @@ -35,7 +35,7 @@ impl Payload for Html { && (content_type.subtype() == "html" || content_type .suffix() - .map_or(false, |v| v == "html"))) + .is_some_and(|v| v == "html"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/json.rs b/poem-openapi/src/payload/json.rs index ce858a9d96..62e00900eb 100644 --- a/poem-openapi/src/payload/json.rs +++ b/poem-openapi/src/payload/json.rs @@ -37,7 +37,7 @@ impl Payload for Json { && (content_type.subtype() == "json" || content_type .suffix() - .map_or(false, |v| v == "json"))) + .is_some_and(|v| v == "json"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/plain_text.rs b/poem-openapi/src/payload/plain_text.rs index 8adcc40337..62fa4998ec 100644 --- a/poem-openapi/src/payload/plain_text.rs +++ b/poem-openapi/src/payload/plain_text.rs @@ -35,7 +35,7 @@ impl Payload for PlainText { && (content_type.subtype() == "plain" || content_type .suffix() - .map_or(false, |v| v == "plain"))) + .is_some_and(|v| v == "plain"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/xml.rs b/poem-openapi/src/payload/xml.rs index 36558e4470..2998d16a02 100644 --- a/poem-openapi/src/payload/xml.rs +++ b/poem-openapi/src/payload/xml.rs @@ -37,7 +37,7 @@ impl Payload for Xml { && (content_type.subtype() == "xml" || content_type .suffix() - .map_or(false, |v| v == "xml"))) + .is_some_and(|v| v == "xml"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/payload/yaml.rs b/poem-openapi/src/payload/yaml.rs index 24e4bd5d78..e7c587b1d2 100644 --- a/poem-openapi/src/payload/yaml.rs +++ b/poem-openapi/src/payload/yaml.rs @@ -37,7 +37,7 @@ impl Payload for Yaml { && (content_type.subtype() == "yaml" || content_type .suffix() - .map_or(false, |v| v == "yaml"))) + .is_some_and(|v| v == "yaml"))) } fn schema_ref() -> MetaSchemaRef { diff --git a/poem-openapi/src/registry/ser.rs b/poem-openapi/src/registry/ser.rs index ade9eb0591..0d394a6cc4 100644 --- a/poem-openapi/src/registry/ser.rs +++ b/poem-openapi/src/registry/ser.rs @@ -24,7 +24,7 @@ impl Serialize for MetaSchemaRef { struct PathMap<'a>(&'a [MetaApi], Option<&'a str>); -impl<'a> Serialize for PathMap<'a> { +impl Serialize for PathMap<'_> { fn serialize(&self, serializer: S) -> Result { let mut s = serializer.serialize_map(Some(self.0.len()))?; for api in self.0 { @@ -66,7 +66,7 @@ impl Serialize for MetaResponses { struct WebhookMap<'a>(&'a [MetaWebhook]); -impl<'a> Serialize for WebhookMap<'a> { +impl Serialize for WebhookMap<'_> { fn serialize(&self, serializer: S) -> Result { let mut s = serializer.serialize_map(Some(self.0.len()))?; for webhook in self.0 { @@ -86,7 +86,7 @@ pub(crate) struct Document<'a> { pub(crate) url_prefix: Option<&'a str>, } -impl<'a> Serialize for Document<'a> { +impl Serialize for Document<'_> { fn serialize(&self, serializer: S) -> Result { #[derive(Serialize)] #[serde(rename_all = "camelCase")] diff --git a/poem-openapi/src/types/external/string.rs b/poem-openapi/src/types/external/string.rs index 27c09b7b8a..31078de0ea 100644 --- a/poem-openapi/src/types/external/string.rs +++ b/poem-openapi/src/types/external/string.rs @@ -83,7 +83,7 @@ impl ToHeader for String { } } -impl<'a> Type for &'a str { +impl Type for &str { const IS_REQUIRED: bool = true; type RawValueType = Self; @@ -109,7 +109,7 @@ impl<'a> Type for &'a str { } } -impl<'a> ToJSON for &'a str { +impl ToJSON for &str { fn to_json(&self) -> Option { Some(Value::String(self.to_string())) } diff --git a/poem/src/endpoint/endpoint.rs b/poem/src/endpoint/endpoint.rs index e23aee7c6c..5a5613499b 100644 --- a/poem/src/endpoint/endpoint.rs +++ b/poem/src/endpoint/endpoint.rs @@ -93,7 +93,7 @@ where } } -/// The enum `EitherEndpoint` with variants `Left`` and `Right` is a general +/// The enum `EitherEndpoint` with variants `Left` and `Right` is a general /// purpose sum type with two cases. pub enum EitherEndpoint { /// A endpoint of type `A` diff --git a/poem/src/middleware/mod.rs b/poem/src/middleware/mod.rs index 0fe8d26a22..bbc072b9a2 100644 --- a/poem/src/middleware/mod.rs +++ b/poem/src/middleware/mod.rs @@ -322,9 +322,8 @@ where } } -/// The enum `EitherMiddleware` with variants `Left`` and `Right` is a general +/// The enum `EitherMiddleware` with variants `Left` and `Right` is a general /// purpose sum type with two cases. - pub enum EitherMiddleware { /// A middleware of type `A` A(A, PhantomData), diff --git a/poem/src/web/cookie.rs b/poem/src/web/cookie.rs index a241778b47..1b61253d8f 100644 --- a/poem/src/web/cookie.rs +++ b/poem/src/web/cookie.rs @@ -574,7 +574,7 @@ pub struct PrivateCookieJar<'a> { cookie_jar: &'a CookieJar, } -impl<'a> PrivateCookieJar<'a> { +impl PrivateCookieJar<'_> { /// Adds cookie to the parent jar. The cookie’s value is encrypted with /// authenticated encryption assuring confidentiality, integrity, and /// authenticity. @@ -608,7 +608,7 @@ pub struct SignedCookieJar<'a> { cookie_jar: &'a CookieJar, } -impl<'a> SignedCookieJar<'a> { +impl SignedCookieJar<'_> { /// Adds cookie to the parent jar. The cookie’s value is signed assuring /// integrity and authenticity. pub fn add(&self, cookie: Cookie) { diff --git a/poem/src/web/form.rs b/poem/src/web/form.rs index c1f7e48078..4ca19db73c 100644 --- a/poem/src/web/form.rs +++ b/poem/src/web/form.rs @@ -118,7 +118,7 @@ fn is_form_content_type(content_type: &str) -> bool { && (content_type.subtype() == "x-www-form-urlencoded" || content_type .suffix() - .map_or(false, |v| v == "x-www-form-urlencoded"))) + .is_some_and(|v| v == "x-www-form-urlencoded"))) } #[cfg(test)] diff --git a/poem/src/web/json.rs b/poem/src/web/json.rs index d40c13da10..88903ffc7c 100644 --- a/poem/src/web/json.rs +++ b/poem/src/web/json.rs @@ -137,7 +137,7 @@ fn is_json_content_type(content_type: &str) -> bool { && (content_type.subtype() == "json" || content_type .suffix() - .map_or(false, |v| v == "json"))) + .is_some_and(|v| v == "json"))) } impl IntoResponse for Json { diff --git a/poem/src/web/xml.rs b/poem/src/web/xml.rs index 28c45eb85c..396ed0ba2d 100644 --- a/poem/src/web/xml.rs +++ b/poem/src/web/xml.rs @@ -130,7 +130,7 @@ fn is_xml_content_type(content_type: &str) -> bool { && (content_type.subtype() == "xml" || content_type .suffix() - .map_or(false, |v| v == "xml"))) + .is_some_and(|v| v == "xml"))) } impl IntoResponse for Xml { diff --git a/poem/src/web/yaml.rs b/poem/src/web/yaml.rs index 1960ec694b..60f361bab9 100644 --- a/poem/src/web/yaml.rs +++ b/poem/src/web/yaml.rs @@ -131,7 +131,7 @@ fn is_yaml_content_type(content_type: &str) -> bool { && (content_type.subtype() == "yaml" || content_type .suffix() - .map_or(false, |v| v == "yaml"))) + .is_some_and(|v| v == "yaml"))) } impl IntoResponse for Yaml {