Skip to content

Commit

Permalink
fix new warnings + fix some recursive bug from last PR merge
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenDC committed Dec 10, 2024
1 parent 31e059d commit 872ea66
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 27 deletions.
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ check:
clippy:
cargo clippy --workspace --all-targets --all-features

clippy-fix:
cargo clippy --fix
clippy-fix *ARGS:
cargo clippy --workspace --all-targets --all-features --fix {{ARGS}}

typos:
typos -w
Expand Down
2 changes: 1 addition & 1 deletion rama-core/src/layer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub trait Layer<S> {
fn layer(&self, inner: S) -> Self::Service;
}

impl<'a, T, S> Layer<S> for &'a T
impl<T, S> Layer<S> for &T
where
T: ?Sized + Layer<S>,
{
Expand Down
2 changes: 1 addition & 1 deletion rama-haproxy/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<'a> From<Result<v2::Header<'a>, v2::ParseError>> for HeaderResult<'a> {
}
}

impl<'a> PartialResult for HeaderResult<'a> {
impl PartialResult for HeaderResult<'_> {
fn is_incomplete(&self) -> bool {
match self {
Self::V1(result) => result.is_incomplete(),
Expand Down
2 changes: 1 addition & 1 deletion rama-haproxy/src/protocol/v1/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl From<IPv6> for Addresses {
}
}

impl<'a> fmt::Display for Header<'a> {
impl fmt::Display for Header<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.header.as_ref())
}
Expand Down
6 changes: 3 additions & 3 deletions rama-haproxy/src/protocol/v2/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl WriteToHeader for Addresses {
}
}

impl<'a> WriteToHeader for TypeLengthValue<'a> {
impl WriteToHeader for TypeLengthValue<'_> {
fn write_to(&self, writer: &mut Writer) -> io::Result<usize> {
if self.value.len() > u16::MAX as usize {
return Err(io::ErrorKind::WriteZero.into());
Expand All @@ -146,7 +146,7 @@ impl<'a> WriteToHeader for TypeLengthValue<'a> {
}
}

impl<'a, T: Copy + Into<u8>> WriteToHeader for (T, &'a [u8]) {
impl<T: Copy + Into<u8>> WriteToHeader for (T, &[u8]) {
fn write_to(&self, writer: &mut Writer) -> io::Result<usize> {
let kind = self.0.into();
let value = self.1;
Expand All @@ -163,7 +163,7 @@ impl<'a, T: Copy + Into<u8>> WriteToHeader for (T, &'a [u8]) {
}
}

impl<'a> WriteToHeader for TypeLengthValues<'a> {
impl WriteToHeader for TypeLengthValues<'_> {
fn write_to(&self, writer: &mut Writer) -> io::Result<usize> {
let bytes = self.as_bytes();

Expand Down
8 changes: 4 additions & 4 deletions rama-haproxy/src/protocol/v2/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub enum Type {
NetworkNamespace = 0x30,
}

impl<'a> fmt::Display for Header<'a> {
impl fmt::Display for Header<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
Expand All @@ -186,7 +186,7 @@ impl<'a> fmt::Display for Header<'a> {
}
}

impl<'a> Header<'a> {
impl Header<'_> {
/// Creates an owned clone of this [`Header`].
pub fn to_owned(&self) -> Header<'static> {
Header {
Expand Down Expand Up @@ -250,7 +250,7 @@ impl<'a> Header<'a> {
}
}

impl<'a> TypeLengthValues<'a> {
impl TypeLengthValues<'_> {
/// The underlying byte slice of the `TypeLengthValue`s portion of the `Header` payload.
pub fn as_bytes(&self) -> &[u8] {
self.bytes
Expand Down Expand Up @@ -296,7 +296,7 @@ impl<'a> Iterator for TypeLengthValues<'a> {
}
}

impl<'a> TypeLengthValues<'a> {
impl TypeLengthValues<'_> {
/// The number of bytes in the `TypeLengthValue` portion of the `Header`.
pub fn len(&self) -> u16 {
self.bytes.len() as u16
Expand Down
8 changes: 4 additions & 4 deletions rama-http-backend/src/server/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct Http1Config<'a> {
inner: &'a mut Http1ConnBuilder,
}

impl<'a> Http1Config<'a> {
impl Http1Config<'_> {
/// Set whether HTTP/1 connections should support half-closures.
///
/// Clients can chose to shutdown their write-side while waiting
Expand Down Expand Up @@ -235,7 +235,7 @@ pub struct H2Config<'a, E> {
inner: &'a mut H2ConnBuilder<E>,
}

impl<'a, E> H2Config<'a, E> {
impl<E> H2Config<'_, E> {
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
/// stream-level flow control.
///
Expand Down Expand Up @@ -394,7 +394,7 @@ impl std::fmt::Debug for AutoHttp1Config<'_, ()> {
}
}

impl<'a, E> AutoHttp1Config<'a, E> {
impl<E> AutoHttp1Config<'_, E> {
/// Set whether HTTP/1 connections should support half-closures.
///
/// Clients can chose to shutdown their write-side while waiting
Expand Down Expand Up @@ -514,7 +514,7 @@ impl std::fmt::Debug for AutoH2Config<'_, ()> {
}
}

impl<'a, E> AutoH2Config<'a, E> {
impl<E> AutoH2Config<'_, E> {
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
/// stream-level flow control.
///
Expand Down
2 changes: 1 addition & 1 deletion rama-http/src/service/client/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ pub struct RequestBuilder<'a, S, State, Response> {
_phantom: std::marker::PhantomData<fn(State, Response) -> ()>,
}

impl<'a, S, State, Response> std::fmt::Debug for RequestBuilder<'a, S, State, Response>
impl<S, State, Response> std::fmt::Debug for RequestBuilder<'_, S, State, Response>
where
S: std::fmt::Debug,
{
Expand Down
2 changes: 1 addition & 1 deletion rama-net/src/address/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl<'a> TryFrom<rustls::pki_types::ServerName<'a>> for Host {
}

#[cfg(feature = "rustls")]
impl<'a> TryFrom<Host> for rustls::pki_types::ServerName<'a> {
impl TryFrom<Host> for rustls::pki_types::ServerName<'_> {
type Error = OpaqueError;

fn try_from(value: Host) -> Result<Self, Self::Error> {
Expand Down
14 changes: 10 additions & 4 deletions rama-net/src/address/socket_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ impl From<SocketAddress> for SocketAddr {

impl From<(IpAddr, u16)> for SocketAddress {
#[inline]
fn from((ip, port): (IpAddr, u16)) -> Self {
(ip, port).into()
fn from((ip_addr, port): (IpAddr, u16)) -> Self {
Self { ip_addr, port }
}
}

impl From<(Ipv4Addr, u16)> for SocketAddress {
#[inline]
fn from((ip, port): (Ipv4Addr, u16)) -> Self {
(ip, port).into()
Self {
ip_addr: ip.into(),
port,
}
}
}

Expand All @@ -88,7 +91,10 @@ impl From<([u8; 4], u16)> for SocketAddress {
impl From<(Ipv6Addr, u16)> for SocketAddress {
#[inline]
fn from((ip, port): (Ipv6Addr, u16)) -> Self {
(ip, port).into()
Self {
ip_addr: ip.into(),
port,
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions rama-proxy/src/proxydb/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Proxy {
}
}

return filter
filter
.continent
.as_ref()
.map(|c| {
Expand Down Expand Up @@ -172,7 +172,7 @@ impl Proxy {
.residential
.map(|r| r == self.residential)
.unwrap_or(true)
&& filter.mobile.map(|m| m == self.mobile).unwrap_or(true);
&& filter.mobile.map(|m| m == self.mobile).unwrap_or(true)
}
}

Expand Down
2 changes: 1 addition & 1 deletion rama-tls/src/boring/client/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl<S> TlsConnector<S, ConnectorKindTunnel> {
}
}

/// this way we do not need a hacky macro... however is there a way to do this without needing to hacK?!?!
// this way we do not need a hacky macro... however is there a way to do this without needing to hacK?!?!

impl<S, State, Request> Service<State, Request> for TlsConnector<S, ConnectorKindAuto>
where
Expand Down
2 changes: 1 addition & 1 deletion rama-tls/src/rustls/client/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl<S> TlsConnector<S, ConnectorKindTunnel> {
}
}

/// this way we do not need a hacky macro... however is there a way to do this without needing to hacK?!?!
// this way we do not need a hacky macro... however is there a way to do this without needing to hacK?!?!

impl<S, State, Request> Service<State, Request> for TlsConnector<S, ConnectorKindAuto>
where
Expand Down
2 changes: 1 addition & 1 deletion rama-tls/src/rustls/key_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct PlainHex<'a, T: 'a> {
slice: &'a [T],
}

impl<'a, T: fmt::LowerHex> fmt::LowerHex for PlainHex<'a, T> {
impl<T: fmt::LowerHex> fmt::LowerHex for PlainHex<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt_inner_hex(self.slice, f, fmt::LowerHex::fmt)
}
Expand Down

0 comments on commit 872ea66

Please sign in to comment.