From f6e128abfe1bca413ab9aa6661f3ec6b7e7253ce Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:18:42 -0700 Subject: [PATCH] style(lib): enforce clippy::redundant_closure_for_method_calls see https://github.com/hyperium/hyper/issues/4071. replace closures that only call a method with the method path, and remove the lint from the clippy allowlist. --- Cargo.toml | 1 - src/common/buf.rs | 2 +- src/error.rs | 2 +- src/server/conn/http1.rs | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 33fa8fee91..d1738cc1ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,7 +125,6 @@ multiple_inherent_impl = "allow" multiple_unsafe_ops_per_block = "allow" needless_pass_by_value = "allow" pattern_type_mismatch = "allow" -redundant_closure_for_method_calls = "allow" redundant_else = "allow" struct_excessive_bools = "allow" # TODO: bogus lint? trivially_copy_pass_by_ref = "allow" diff --git a/src/common/buf.rs b/src/common/buf.rs index 0bf02497f4..fba2aaaebe 100644 --- a/src/common/buf.rs +++ b/src/common/buf.rs @@ -29,7 +29,7 @@ impl BufList { impl Buf for BufList { #[inline] fn remaining(&self) -> usize { - self.bufs.iter().map(|buf| buf.remaining()).sum() + self.bufs.iter().map(Buf::remaining).sum() } #[inline] diff --git a/src/error.rs b/src/error.rs index 1ccd09b7a9..bfbcf90cc5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -354,7 +354,7 @@ impl Error { // Find an h2::Reason somewhere in the cause stack, if it exists, // otherwise assume an INTERNAL_ERROR. self.find_source::() - .and_then(|h2_err| h2_err.reason()) + .and_then(h2::Error::reason) .unwrap_or(h2::Reason::INTERNAL_ERROR) } diff --git a/src/server/conn/http1.rs b/src/server/conn/http1.rs index 8dc83ab586..12ab61cc4f 100644 --- a/src/server/conn/http1.rs +++ b/src/server/conn/http1.rs @@ -555,7 +555,7 @@ where /// Return the inner IO object, and additional information provided the connection /// has not yet been upgraded. pub fn into_parts(self) -> Option> { - self.inner.map(|conn| conn.into_parts()) + self.inner.map(Connection::into_parts) } }