Skip to content

Commit

Permalink
Merge pull request #292 from moka-rs/fix-ci-2023-07-v010
Browse files Browse the repository at this point in the history
Fix Cilppy warnings and MSRV CI for v0.10.x
  • Loading branch information
tatsuya6502 authored Jul 29, 2023
2 parents a0f7c26 + f62f0f2 commit 9edccec
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .ci_extras/pin-crate-vers-msrv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -eux

# Pin some dependencies to specific versions for the MSRV.
cargo update -p tempfile --precise 3.6.0
7 changes: 7 additions & 0 deletions .ci_extras/pin-crate-vers-nightly.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 nightly toolchain.
cargo update -p openssl --precise 0.10.39
cargo update -p cc --precise 1.0.61
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ linux_arm64_task:
# pin_deps_script: |
# if [ "v$RUST_VERSION" == "v1.60.0" ]; then
# echo 'Pinning some dependencies to specific versions'
# cargo update -p <crate> --precise <version>
# ./.ci_extras/pin-crate-vers-msrv.sh
# else
# echo 'Skipped'
# fi
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ jobs:

- name: Pin some dependencies to specific versions (Nightly only)
if: ${{ matrix.rust == 'nightly' }}
run: |
cargo update -p openssl --precise 0.10.39
cargo update -p cc --precise 1.0.61
run: ./.ci_extras/pin-crate-vers-nightly.sh

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

- name: Show cargo tree
uses: actions-rs/cargo@v1
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/CIQuantaDisabled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@ jobs:

- name: Pin some dependencies to specific versions (Nightly only)
if: ${{ matrix.rust == 'nightly' }}
run: |
cargo update -p openssl --precise 0.10.39
cargo update -p cc --precise 1.0.61
run: ./.ci_extras/pin-crate-vers-nightly.sh

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

- name: Run tests (debug, but no quanta feature)
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,16 +41,17 @@ jobs:

- name: Run Clippy
uses: actions-rs/clippy-check@v1
if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Specify individual features until we remove `dash` feature.
# args: --lib --tests --all-features --all-targets -- -D warnings
args: --lib --tests --features 'future, logging, unstable-debug-counters' --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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/moka-rs/moka"
keywords = ["cache", "concurrent"]
categories = ["caching", "concurrency"]
readme = "README.md"
exclude = [".circleci", ".devcontainer", ".github", ".gitpod.yml", ".vscode"]
exclude = [".ci_extras", ".circleci", ".devcontainer", ".github", ".gitpod.yml", ".vscode"]
build = "build.rs"

[features]
Expand Down
4 changes: 2 additions & 2 deletions src/cht/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ mod tests {

for result in insert_threads
.into_iter()
.chain(remove_threads.into_iter())
.chain(remove_threads)
.map(|t| t.join())
{
assert!(result.is_ok());
Expand Down Expand Up @@ -1042,7 +1042,7 @@ mod tests {

for result in insert_threads
.into_iter()
.chain(remove_threads.into_iter())
.chain(remove_threads)
.map(JoinHandle::join)
{
assert!(result.is_ok());
Expand Down
2 changes: 1 addition & 1 deletion src/common/frequency_sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,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
6 changes: 5 additions & 1 deletion src/notification/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,13 @@ impl<K, V> ThreadPoolRemovalNotifier<K, V> {
is_running: Default::default(),
is_shutting_down: Default::default(),
};

#[cfg_attr(beta_clippy, allow(clippy::arc_with_non_send_sync))]
let state = Arc::new(state);

Self {
snd,
state: Arc::new(state),
state,
thread_pool,
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3, thread4, thread5] {
for t in [thread1, thread2, thread3, thread4, thread5] {
t.join().expect("Failed to join");
}
}
Expand Down Expand Up @@ -2789,7 +2789,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3, thread4, thread5] {
for t in [thread1, thread2, thread3, thread4, thread5] {
t.join().expect("Failed to join");
}
}
Expand Down Expand Up @@ -2924,7 +2924,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3063,7 +3063,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3202,7 +3202,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3341,7 +3341,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3470,7 +3470,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3599,7 +3599,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3957,7 +3957,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3] {
for t in [thread1, thread2, thread3] {
t.join().expect("Failed to join");
}

Expand Down
8 changes: 4 additions & 4 deletions src/sync/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3, thread4, thread5] {
for t in [thread1, thread2, thread3, thread4, thread5] {
t.join().expect("Failed to join");
}
}
Expand Down Expand Up @@ -1573,7 +1573,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -1711,7 +1711,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -1840,7 +1840,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down
1 change: 1 addition & 0 deletions src/sync_base/invalidator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl<K, V, S> Invalidator<K, V, S> {
Self {
predicates: RwLock::new(HashMap::new()),
is_empty: AtomicBool::new(true),
#[cfg_attr(beta_clippy, allow(clippy::arc_with_non_send_sync))]
scan_context: Arc::new(ScanContext::new(cache)),
thread_pool,
}
Expand Down

0 comments on commit 9edccec

Please sign in to comment.