Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
clippy 0.1.72 (a47f796a365 2023-07-22)
  • Loading branch information
tatsuya6502 committed Jul 29, 2023
1 parent a0f7c26 commit bc60351
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
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
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 bc60351

Please sign in to comment.