From f1cb334d34c2af62aa9fd6e6dc2c44e194634907 Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Thu, 25 Apr 2024 13:32:53 +0200 Subject: [PATCH 1/2] fix cargo-codspeed in with workspaces in CI (#1741) --- .github/workflows/codspeed.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 128bdc49..f35ed373 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -23,12 +23,10 @@ jobs: bins: cargo-codspeed - name: Build the benchmark target(s) - working-directory: ./benchmarks - run: cargo codspeed build + run: cargo codspeed build -p benchmarks - name: Run the benchmarks uses: CodSpeedHQ/action@v2 with: - working-directory: ./benchmarks - run: cargo codspeed run + run: cargo codspeed run -p benchmarks token: ${{ secrets.CODSPEED_TOKEN }} From 1ce0fade98ab939e2a939cd3c8d99cc30935bc07 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Thu, 25 Apr 2024 13:34:39 +0200 Subject: [PATCH 2/2] clippy (#1739) --- src/bits/complete.rs | 62 +++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/bits/complete.rs b/src/bits/complete.rs index d133bccb..a99ad8ac 100644 --- a/src/bits/complete.rs +++ b/src/bits/complete.rs @@ -42,41 +42,39 @@ where move |(input, bit_offset): (I, usize)| { if count == 0 { Ok(((input, bit_offset), 0u8.into())) + } else if input.input_len() * 8 < count + bit_offset { + Err(Err::Error(E::from_error_kind( + (input, bit_offset), + ErrorKind::Eof, + ))) } else { - if input.input_len() * 8 < count + bit_offset { - Err(Err::Error(E::from_error_kind( - (input, bit_offset), - ErrorKind::Eof, - ))) - } else { - let cnt = (count + bit_offset).div(8); - let mut acc: O = 0_u8.into(); - let mut offset: usize = bit_offset; - let mut remaining: usize = count; - let mut end_offset: usize = 0; - - for byte in input.iter_elements().take(cnt + 1) { - if remaining == 0 { - break; - } - let val: O = if offset == 0 { - byte.into() - } else { - ((byte << offset) >> offset).into() - }; - - if remaining < 8 - offset { - acc += val >> (8 - offset - remaining); - end_offset = remaining + offset; - break; - } else { - acc += val << (remaining - (8 - offset)); - remaining -= 8 - offset; - offset = 0; - } + let cnt = (count + bit_offset).div(8); + let mut acc: O = 0_u8.into(); + let mut offset: usize = bit_offset; + let mut remaining: usize = count; + let mut end_offset: usize = 0; + + for byte in input.iter_elements().take(cnt + 1) { + if remaining == 0 { + break; + } + let val: O = if offset == 0 { + byte.into() + } else { + ((byte << offset) >> offset).into() + }; + + if remaining < 8 - offset { + acc += val >> (8 - offset - remaining); + end_offset = remaining + offset; + break; + } else { + acc += val << (remaining - (8 - offset)); + remaining -= 8 - offset; + offset = 0; } - Ok(((input.take_from(cnt), end_offset), acc)) } + Ok(((input.take_from(cnt), end_offset), acc)) } } }