Skip to content

Commit a6b675d

Browse files
committed
refactor(clippy): Allow manual_range_contains
1 parent d2b8613 commit a6b675d

File tree

7 files changed

+5
-7
lines changed

7 files changed

+5
-7
lines changed

src/frame/headers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ pub fn parse_u64(src: &[u8]) -> Result<u64, ParseU64Error> {
321321
let mut ret = 0;
322322

323323
for &d in src {
324-
if !(b'0'..=b'9').contains(&d) {
324+
if d < b'0' || d > b'9' {
325325
return Err(ParseU64Error);
326326
}
327327

src/frame/settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl Settings {
8888

8989
pub fn set_max_frame_size(&mut self, size: Option<u32>) {
9090
if let Some(val) = size {
91-
assert!((DEFAULT_MAX_FRAME_SIZE..=MAX_MAX_FRAME_SIZE).contains(&val));
91+
assert!(DEFAULT_MAX_FRAME_SIZE <= val && val <= MAX_MAX_FRAME_SIZE);
9292
}
9393
self.max_frame_size = size;
9494
}
@@ -182,7 +182,7 @@ impl Settings {
182182
}
183183
}
184184
Some(MaxFrameSize(val)) => {
185-
if (DEFAULT_MAX_FRAME_SIZE..=MAX_MAX_FRAME_SIZE).contains(&val) {
185+
if DEFAULT_MAX_FRAME_SIZE <= val && val <= MAX_MAX_FRAME_SIZE {
186186
settings.max_frame_size = Some(val);
187187
} else {
188188
return Err(Error::InvalidSettingValue);

src/hpack/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ fn decode_int<B: Buf>(buf: &mut B, prefix_size: u8) -> Result<usize, DecoderErro
396396
const VARINT_MASK: u8 = 0b0111_1111;
397397
const VARINT_FLAG: u8 = 0b1000_0000;
398398

399-
if !(1..=8).contains(&prefix_size) {
399+
if prefix_size < 1 || prefix_size > 8 {
400400
return Err(DecoderError::InvalidIntegerPrefix);
401401
}
402402

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#![doc(html_root_url = "https://docs.rs/h2/0.3.15")]
8282
#![deny(missing_debug_implementations, missing_docs)]
8383
#![cfg_attr(test, deny(warnings))]
84+
#![allow(clippy::type_complexity, clippy::manual_range_contains)]
8485

8586
macro_rules! proto_err {
8687
(conn: $($msg:tt)+) => {

src/proto/streams/recv.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ impl Recv {
263263
}
264264

265265
/// Called by the client to get pushed response
266-
#[allow(clippy::type_complexity)]
267266
pub fn poll_pushed(
268267
&mut self,
269268
cx: &Context,

src/proto/streams/streams.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,6 @@ impl OpaqueStreamRef {
12701270
me.actions.recv.poll_response(cx, &mut stream)
12711271
}
12721272
/// Called by a client to check for a pushed request.
1273-
#[allow(clippy::type_complexity)]
12741273
pub fn poll_pushed(
12751274
&mut self,
12761275
cx: &Context,

src/server.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ where
407407
}
408408

409409
#[doc(hidden)]
410-
#[allow(clippy::type_complexity)]
411410
pub fn poll_accept(
412411
&mut self,
413412
cx: &mut Context<'_>,

0 commit comments

Comments
 (0)