Skip to content

Commit

Permalink
Merge pull request #9 from moka-rs/fix-ci-2023-07
Browse files Browse the repository at this point in the history
Fix Cilppy warnings and MSRV CI
  • Loading branch information
tatsuya6502 authored Jul 29, 2023
2 parents 369e19b + 0d01d2b commit 66abef3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .ci_extras/pin-crate-vers-msrv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -eux

# Pin some dependencies to specific versions for the MSRV.
cargo update -p dashmap --precise 5.4.0
cargo update -p tempfile --precise 3.6.0
7 changes: 3 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ jobs:
command: update
args: -Z minimal-versions

# - name: Pin some dependencies to specific versions (MSRV only)
# if: ${{ matrix.rust == '1.61.0' }}
# run: |
# cargo update -p dashmap --precise 5.2.0
- name: Pin some dependencies to specific versions (MSRV only)
if: ${{ matrix.rust == '1.61.0' }}
run: ./.ci_extras/pin-crate-vers-msrv.sh

- name: Show cargo tree
uses: actions-rs/cargo@v1
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/Lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
strategy:
matrix:
rust:
- stable
- beta
- toolchain: stable
- toolchain: beta
rustflags: '--cfg beta_clippy'

steps:
- name: Checkout Moka
Expand All @@ -27,7 +28,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
toolchain: ${{ matrix.rust.toolchain }}
override: true
components: rustfmt, clippy

Expand All @@ -40,14 +41,15 @@ jobs:

- name: Run Clippy
uses: actions-rs/clippy-check@v1
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --lib --tests --all-features --all-targets -- -D warnings
env:
RUSTFLAGS: ${{ matrix.rust.rustflags }}

- name: Run Rustfmt
uses: actions-rs/cargo@v1
if: ${{ matrix.rust == 'stable' }}
if: ${{ matrix.rust.toolchain == 'stable' }}
with:
command: fmt
args: --all -- --check
2 changes: 1 addition & 1 deletion src/common/frequency_sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ mod tests {
let mut sketch = FrequencySketch::default();
sketch.ensure_capacity(512);
let mut indexes = std::collections::HashSet::new();
let hashes = vec![std::u64::MAX, 0, 1];
let hashes = [std::u64::MAX, 0, 1];
for hash in hashes.iter() {
for depth in 0..4 {
indexes.insert(sketch.index_of(*hash, depth));
Expand Down
11 changes: 6 additions & 5 deletions src/sync/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ where
) -> Self {
let (r_snd, r_rcv) = crossbeam_channel::bounded(READ_LOG_SIZE);
let (w_snd, w_rcv) = crossbeam_channel::bounded(WRITE_LOG_SIZE);
let inner = Arc::new(Inner::new(

let inner = Inner::new(
max_capacity,
initial_capacity,
build_hasher,
Expand All @@ -106,13 +107,13 @@ where
w_rcv,
time_to_live,
time_to_idle,
));
let housekeeper = Housekeeper::default();
);
Self {
inner,
#[cfg_attr(beta_clippy, allow(clippy::arc_with_non_send_sync))]
inner: Arc::new(inner),
read_op_ch: r_snd,
write_op_ch: w_snd,
housekeeper: Some(Arc::new(housekeeper)),
housekeeper: Some(Arc::new(Housekeeper::default())),
}
}

Expand Down

0 comments on commit 66abef3

Please sign in to comment.