Skip to content

Commit 3731573

Browse files
authored
meta: specify rust-version and add cargo-msrv to CI (#100)
* meta: specify rust-version and add cargo-msrv to CI * fix(style): nightly clippy (#99) * style(sequence decoder): migrate .is_some() -> .unwrap to if let to make clippy happy * feat(cli): replace unix specific code with os generic variant * style: nightly clippy --------- Co-authored-by: arc <zleyyij@users.noreply.github.com>
1 parent ae6eb55 commit 3731573

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: CI
44

55
jobs:
66
tests:
7-
name: Check
7+
name: stable lint, test, build
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout sources
@@ -14,16 +14,23 @@ jobs:
1414
uses: dtolnay/rust-toolchain@stable
1515
with:
1616
components: clippy
17-
- name: Install cargo-hack
17+
- name: Install cargo-hack and cargo-msrv
1818
uses: taiki-e/install-action@v2
1919
with:
20-
tool: cargo-hack
21-
- run: cargo hack check --workspace --feature-powerset --exclude-features rustc-dep-of-std
22-
- run: cargo hack clippy --workspace --feature-powerset --exclude-features rustc-dep-of-std
23-
- run: cargo hack test --workspace --feature-powerset --exclude-features rustc-dep-of-std
20+
tool: cargo-hack, cargo-msrv
21+
- name: check
22+
run: cargo hack check --workspace --feature-powerset --exclude-features rustc-dep-of-std
23+
- name: cargo hack clippy
24+
run: cargo hack clippy --workspace --feature-powerset --exclude-features rustc-dep-of-std
25+
- name: cargo hack test
26+
run: cargo hack test --workspace --feature-powerset --exclude-features rustc-dep-of-std
27+
- name: Verify MSRV (cli)
28+
run: cargo msrv verify --path cli/
29+
- name: Verify MSRV (lib)
30+
run: cargo msrv verify --path ruzstd/
2431

2532
nightly-stuff:
26-
name: nightly clippy, format and miri tests
33+
name: nightly lint, miri
2734
runs-on: ubuntu-latest
2835
steps:
2936
- name: Checkout sources
@@ -39,4 +46,3 @@ jobs:
3946
- run: cargo +nightly clippy --workspace -- -D warnings
4047
- run: cargo +nightly miri test ringbuffer
4148
- run: cargo +nightly miri test short_Writer
42-

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This document records the changes made between versions, starting with version 0.5.0
44

55
# After 0.8.2 (Current)
6+
* Introduce the `rust-version` field
67

78
# After 0.8.1
89
* The CLI has been refactored to use `clap`

cli/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
[package]
33
name = "ruzstd-cli"
4-
version = "0.8.1"
4+
version = "0.8.2"
5+
rust-version = "1.87.0"
56
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
67
edition = "2018"
78
license = "MIT"
@@ -26,4 +27,4 @@ ruzstd = { path = "../ruzstd", features = ["std"] }
2627
[dev-dependencies]
2728
criterion = "0.5"
2829
rand = { version = "0.8.5", features = ["small_rng"] }
29-
zstd = "0.13.2"
30+
zstd = "0.13.2"

ruzstd/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "ruzstd"
3-
version = "0.8.2"
3+
version = "0.8.3"
4+
rust-version = "1.87"
45
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
56
edition = "2018"
67
license = "MIT"

ruzstd/src/decoding/ringbuffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl RingBuffer {
154154

155155
self.reserve(len);
156156

157-
debug_assert!(self.len() + len <= self.cap - 1);
157+
debug_assert!(self.len() + len < self.cap);
158158
debug_assert!(self.free() >= len, "free: {} len: {}", self.free(), len);
159159

160160
let ((f1_ptr, f1_len), (f2_ptr, f2_len)) = self.free_slice_parts();

ruzstd/src/fse/fse_encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ pub(super) fn build_table_from_probabilities(probs: &[i32], acc_log: u8) -> FSET
369369
let state = &mut states[symbol];
370370

371371
// We process the states in their order in the table
372-
state.states.sort_by(|l, r| l.index.cmp(&r.index));
372+
state.states.sort_by_key(|l| l.index);
373373

374374
let prob_log = if prob.is_power_of_two() {
375375
prob.ilog2()
@@ -401,7 +401,7 @@ pub(super) fn build_table_from_probabilities(probs: &[i32], acc_log: u8) -> FSET
401401
}
402402

403403
// For encoding we use the states ordered by the indexes they target
404-
state.states.sort_by(|l, r| l.baseline.cmp(&r.baseline));
404+
state.states.sort_by_key(|l| l.baseline);
405405
}
406406

407407
FSETable {

ruzstd/src/huff0/huff0_encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl HuffmanTable {
179179

180180
weights.reverse();
181181
let mut counts_sorted = counts.iter().enumerate().collect::<Vec<_>>();
182-
counts_sorted.sort_by(|(_, c1), (_, c2)| c1.cmp(c2));
182+
counts_sorted.sort_by_key(|(_, c1)| *c1);
183183

184184
let mut weights_distributed = alloc::vec![0; counts.len()];
185185
for (idx, count) in counts_sorted {

0 commit comments

Comments
 (0)