Skip to content

Commit

Permalink
chore: Enable clippy multiple_inherent_impl lint
Browse files Browse the repository at this point in the history
And fix all the warnings.
  • Loading branch information
larseggert committed Jan 8, 2025
1 parent b17233c commit ca307e6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ nursery = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
if_then_some_else_none = "warn"
get_unwrap = "warn"
multiple_inherent_impl = "warn"

# Optimize build dependencies, because bindgen and proc macros / style
# compilation take more to run than to build otherwise.
Expand Down
20 changes: 8 additions & 12 deletions neqo-crypto/src/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ fn signed_cert_timestamp(fd: *mut PRFileDesc) -> Option<Vec<u8>> {
})
}

impl<'a> IntoIterator for &'a CertificateInfo {
type IntoIter = ItemArrayIterator<'a>;
type Item = &'a [u8];
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}

impl CertificateInfo {
pub(crate) fn new(fd: *mut PRFileDesc) -> Option<Self> {
peer_certificate_chain(fd).map(|certs| Self {
Expand All @@ -80,24 +88,12 @@ impl CertificateInfo {
signed_cert_timestamp: signed_cert_timestamp(fd),
})
}
}

impl CertificateInfo {
#[must_use]
pub fn iter(&self) -> ItemArrayIterator<'_> {
self.certs.into_iter()
}
}

impl<'a> IntoIterator for &'a CertificateInfo {
type IntoIter = ItemArrayIterator<'a>;
type Item = &'a [u8];
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}

impl CertificateInfo {
#[must_use]
pub const fn stapled_ocsp_responses(&self) -> &Option<Vec<Vec<u8>>> {
&self.stapled_ocsp_responses
Expand Down
3 changes: 0 additions & 3 deletions neqo-http3/src/frames/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ impl FrameReader {
}
Ok(None)
}
}

impl FrameReader {
fn frame_type_decoded<T: FrameDecoder<T>>(&mut self, frame_type: HFrameType) -> Res<()> {
T::frame_type_allowed(frame_type)?;
self.frame_type = frame_type;
Expand Down
14 changes: 6 additions & 8 deletions neqo-http3/src/push_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ pub struct PushController {
conn_events: Http3ClientEvents,
}

impl Display for PushController {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "Push controller")
}
}

impl PushController {
pub const fn new(max_concurent_push: u64, conn_events: Http3ClientEvents) -> Self {
Self {
Expand All @@ -165,15 +171,7 @@ impl PushController {
conn_events,
}
}
}

impl Display for PushController {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(f, "Push controller")
}
}

impl PushController {
/// A new `push_promise` has been received.
///
/// # Errors
Expand Down
3 changes: 0 additions & 3 deletions neqo-transport/src/connection/idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ impl IdleTimeout {
keep_alive_outstanding: false,
}
}
}

impl IdleTimeout {
pub fn set_peer_timeout(&mut self, peer_timeout: Duration) {
self.timeout = min(self.timeout, peer_timeout);
}
Expand Down

0 comments on commit ca307e6

Please sign in to comment.