From 1b6624d8a2338ad18a23a236b2d91baa4732d88f Mon Sep 17 00:00:00 2001 From: Gavin Dunlap Date: Thu, 10 Sep 2026 23:02:24 -0400 Subject: [PATCH] style(lib): Address trivial, low quantity clippy lints. --- Cargo.toml | 7 ------- src/body/chan.rs | 1 + src/common/time.rs | 2 +- src/proto/h1/decode.rs | 2 +- src/proto/h1/io.rs | 5 ----- src/proto/h2/ping.rs | 2 ++ src/proto/h2/server.rs | 3 +-- 7 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d6bd75c244..9aed53a559 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,18 +119,12 @@ cast_possible_truncation = "allow" # TODO: consider cast_precision_loss = "allow" # TODO: consider checked_conversions = "allow" else_if_without_else = "allow" -enum_glob_use = "allow" float_arithmetic = "allow" indexing_slicing = "allow" -integer_division = "allow" -integer_division_remainder_used = "allow" let_unit_value = "allow" -map_err_ignore = "allow" -map_unwrap_or = "allow" match_wild_err_arm = "allow" missing_fields_in_debug = "allow" # TODO: use finish_non_exhaustive missing_panics_doc = "allow" # TODO: might be false -multiple_inherent_impl = "allow" multiple_unsafe_ops_per_block = "allow" needless_pass_by_value = "allow" panic = "allow" @@ -139,7 +133,6 @@ redundant_closure_for_method_calls = "allow" redundant_else = "allow" struct_excessive_bools = "allow" # TODO: bogus lint? trivially_copy_pass_by_ref = "allow" -unnecessary_trailing_comma = "allow" unnested_or_patterns = "allow" unused_async = "allow" # TODO: is it for API? unused_trait_names = "allow" # TODO: kinda annoying, but might be good to deny diff --git a/src/body/chan.rs b/src/body/chan.rs index b45bea866b..68e4562bea 100644 --- a/src/body/chan.rs +++ b/src/body/chan.rs @@ -124,6 +124,7 @@ impl Sender { #[allow(dead_code)] #[allow(clippy::unused_async_trait_impl)] + #[allow(clippy::map_err_ignore, reason="dead code")] pub(crate) async fn send_trailers(&mut self, trailers: HeaderMap) -> crate::Result<()> { self.try_send_trailers(trailers) .map_err(|_| crate::Error::new_closed()) diff --git a/src/common/time.rs b/src/common/time.rs index b3534f1580..a095eaf7cd 100644 --- a/src/common/time.rs +++ b/src/common/time.rs @@ -77,7 +77,7 @@ impl Time { Time::Timer(..) => Some(dur), }, Dur::Configured(Some(dur)) => match self { - Time::Empty => panic!("timeout `{name}` set, but no timer set",), + Time::Empty => panic!("timeout `{name}` set, but no timer set"), Time::Timer(..) => Some(dur), }, Dur::Default(None) | Dur::Configured(None) => None, diff --git a/src/proto/h1/decode.rs b/src/proto/h1/decode.rs index 65adaa784b..7b052930ef 100644 --- a/src/proto/h1/decode.rs +++ b/src/proto/h1/decode.rs @@ -314,7 +314,7 @@ impl ChunkedState { max_headers_bytes, }: StepArgs<'_>, ) -> Poll> { - use self::ChunkedState::*; + use self::ChunkedState::{Start, Size, SizeLws, Extension, SizeLf, Body, BodyCr, BodyLf, Trailer, TrailerLf, EndCr, EndLf, End}; match *self { Start => ChunkedState::read_start(cx, body, chunk_size), Size => ChunkedState::read_size(cx, body, chunk_size), diff --git a/src/proto/h1/io.rs b/src/proto/h1/io.rs index 386f1be35b..5833004768 100644 --- a/src/proto/h1/io.rs +++ b/src/proto/h1/io.rs @@ -534,12 +534,7 @@ impl WriteBuf { strategy, } } -} -impl WriteBuf -where - B: Buf, -{ fn set_strategy(&mut self, strategy: WriteStrategy) { self.strategy = strategy; } diff --git a/src/proto/h2/ping.rs b/src/proto/h2/ping.rs index 198bff465c..58ac07034b 100644 --- a/src/proto/h2/ping.rs +++ b/src/proto/h2/ping.rs @@ -395,6 +395,8 @@ impl Bdp { // if the current `bytes` sample is at least 2/3 the previous // bdp, increase to double the current sample. + #[allow(clippy::integer_division_remainder_used, reason="bdp heuristic, integer precision loss acceptable")] + #[allow(clippy::integer_division, reason="bdp heuristic, integer precision loss acceptable")] if bytes >= self.bdp as usize * 2 / 3 { self.bdp = (bytes * 2).min(BDP_LIMIT) as WindowSize; trace!("BDP increased to {}", self.bdp); diff --git a/src/proto/h2/server.rs b/src/proto/h2/server.rs index 92026276aa..2098758d9e 100644 --- a/src/proto/h2/server.rs +++ b/src/proto/h2/server.rs @@ -267,8 +267,7 @@ where let ping = self .ping .as_ref() - .map(|ping| ping.0.clone()) - .unwrap_or_else(ping::disabled); + .map_or_else(ping::disabled, |ping| ping.0.clone()); // Record the headers received ping.record_non_data();