Skip to content

Commit

Permalink
refactor(clippy): Allow manual_range_contains
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsiam committed Dec 5, 2022
1 parent d2b8613 commit a6b675d
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/frame/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ pub fn parse_u64(src: &[u8]) -> Result<u64, ParseU64Error> {
let mut ret = 0;

for &d in src {
if !(b'0'..=b'9').contains(&d) {
if d < b'0' || d > b'9' {
return Err(ParseU64Error);
}

Expand Down
4 changes: 2 additions & 2 deletions src/frame/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Settings {

pub fn set_max_frame_size(&mut self, size: Option<u32>) {
if let Some(val) = size {
assert!((DEFAULT_MAX_FRAME_SIZE..=MAX_MAX_FRAME_SIZE).contains(&val));
assert!(DEFAULT_MAX_FRAME_SIZE <= val && val <= MAX_MAX_FRAME_SIZE);
}
self.max_frame_size = size;
}
Expand Down Expand Up @@ -182,7 +182,7 @@ impl Settings {
}
}
Some(MaxFrameSize(val)) => {
if (DEFAULT_MAX_FRAME_SIZE..=MAX_MAX_FRAME_SIZE).contains(&val) {
if DEFAULT_MAX_FRAME_SIZE <= val && val <= MAX_MAX_FRAME_SIZE {
settings.max_frame_size = Some(val);
} else {
return Err(Error::InvalidSettingValue);
Expand Down
2 changes: 1 addition & 1 deletion src/hpack/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ fn decode_int<B: Buf>(buf: &mut B, prefix_size: u8) -> Result<usize, DecoderErro
const VARINT_MASK: u8 = 0b0111_1111;
const VARINT_FLAG: u8 = 0b1000_0000;

if !(1..=8).contains(&prefix_size) {
if prefix_size < 1 || prefix_size > 8 {
return Err(DecoderError::InvalidIntegerPrefix);
}

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#![doc(html_root_url = "https://docs.rs/h2/0.3.15")]
#![deny(missing_debug_implementations, missing_docs)]
#![cfg_attr(test, deny(warnings))]
#![allow(clippy::type_complexity, clippy::manual_range_contains)]

macro_rules! proto_err {
(conn: $($msg:tt)+) => {
Expand Down
1 change: 0 additions & 1 deletion src/proto/streams/recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ impl Recv {
}

/// Called by the client to get pushed response
#[allow(clippy::type_complexity)]
pub fn poll_pushed(
&mut self,
cx: &Context,
Expand Down
1 change: 0 additions & 1 deletion src/proto/streams/streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,6 @@ impl OpaqueStreamRef {
me.actions.recv.poll_response(cx, &mut stream)
}
/// Called by a client to check for a pushed request.
#[allow(clippy::type_complexity)]
pub fn poll_pushed(
&mut self,
cx: &Context,
Expand Down
1 change: 0 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ where
}

#[doc(hidden)]
#[allow(clippy::type_complexity)]
pub fn poll_accept(
&mut self,
cx: &mut Context<'_>,
Expand Down

0 comments on commit a6b675d

Please sign in to comment.