Skip to content

Commit

Permalink
Enabled clippy in CI and ran clippy --fix
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Rodler <mrodler@amazon.de>
  • Loading branch information
Michael Rodler authored and seanmonstar committed Jun 12, 2023
1 parent 972fb6f commit 864430c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ jobs:
run: cargo clean; cargo update -Zminimal-versions; cargo check
if: matrix.rust == 'nightly'

clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Clippy
run: cargo clippy --all-targets --all-features

msrv:
name: Check MSRV
needs: [style]
Expand Down
2 changes: 1 addition & 1 deletion src/frame/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<T: Buf> Data<T> {
///
/// Panics if `dst` cannot contain the data frame.
pub(crate) fn encode_chunk<U: BufMut>(&mut self, dst: &mut U) {
let len = self.data.remaining() as usize;
let len = self.data.remaining();

assert!(dst.remaining_mut() >= len);

Expand Down
6 changes: 3 additions & 3 deletions src/hpack/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl Table {
let mut probe = probe + 1;

probe_loop!(probe < self.indices.len(), {
let pos = &mut self.indices[probe as usize];
let pos = &mut self.indices[probe];

prev = match mem::replace(pos, Some(prev)) {
Some(p) => p,
Expand Down Expand Up @@ -656,12 +656,12 @@ fn to_raw_capacity(n: usize) -> usize {

#[inline]
fn desired_pos(mask: usize, hash: HashValue) -> usize {
(hash.0 & mask) as usize
hash.0 & mask
}

#[inline]
fn probe_distance(mask: usize, hash: HashValue, current: usize) -> usize {
current.wrapping_sub(desired_pos(mask, hash)) & mask as usize
current.wrapping_sub(desired_pos(mask, hash)) & mask
}

fn hash_header(header: &Header) -> HashValue {
Expand Down
2 changes: 1 addition & 1 deletion src/hpack/test/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn test_story(story: Value) {
let mut input: Vec<_> = case
.expect
.iter()
.map(|&(ref name, ref value)| {
.map(|(name, value)| {
Header::new(name.clone().into(), value.clone().into())
.unwrap()
.into()
Expand Down
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@
//! [`client::handshake`]: client/fn.handshake.html

#![doc(html_root_url = "https://docs.rs/h2/0.3.19")]
#![deny(missing_debug_implementations, missing_docs)]
#![cfg_attr(test, deny(warnings))]
#![deny(
missing_debug_implementations,
missing_docs,
clippy::missing_safety_doc,
clippy::undocumented_unsafe_blocks
)]
#![allow(clippy::type_complexity, clippy::manual_range_contains)]
#![cfg_attr(test, deny(warnings))]

macro_rules! proto_err {
(conn: $($msg:tt)+) => {
Expand Down
8 changes: 4 additions & 4 deletions src/proto/streams/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,10 @@ impl State {
}

pub fn is_remote_reset(&self) -> bool {
match self.inner {
Closed(Cause::Error(Error::Reset(_, _, Initiator::Remote))) => true,
_ => false,
}
matches!(
self.inner,
Closed(Cause::Error(Error::Reset(_, _, Initiator::Remote)))
)
}

/// Returns true if the stream is already reset.
Expand Down

0 comments on commit 864430c

Please sign in to comment.