Skip to content

Commit

Permalink
chore: address clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Dec 29, 2024
1 parent 472dbca commit 34327bd
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion actix-http/src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ impl<'a> Drain<'a> {
}
}

impl<'a> Iterator for Drain<'a> {
impl Iterator for Drain<'_> {
type Item = (Option<HeaderName>, HeaderValue);

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion actix-http/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn write_content_length<B: BufMut>(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<B> io::Write for MutWriter<'_, B>
where
B: BufMut,
{
Expand Down
2 changes: 1 addition & 1 deletion actix-http/src/http_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub trait HttpMessage: Sized {
}
}

impl<'a, T> HttpMessage for &'a mut T
impl<T> HttpMessage for &mut T
where
T: HttpMessage,
{
Expand Down
2 changes: 1 addition & 1 deletion actix-router/src/resource_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl ResourcePath for String {
}
}

impl<'a> ResourcePath for &'a str {
impl ResourcePath for &str {
fn path(&self) -> &str {
self
}
Expand Down
2 changes: 1 addition & 1 deletion actix-web-codegen/tests/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion actix-web/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<B> io::Write for MutWriter<'_, B>
where
B: BufMut,
{
Expand Down
2 changes: 1 addition & 1 deletion actix-web/src/middleware/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion actix-web/src/types/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl<T: DeserializeOwned> JsonBody<T> {
(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
Expand Down
15 changes: 10 additions & 5 deletions awc/src/client/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion awc/src/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ struct Host<'a> {
port: Option<http::uri::Port<&'a str>>,
}

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)?;

Expand Down

0 comments on commit 34327bd

Please sign in to comment.