Skip to content

Commit 6c27d44

Browse files
committed
wip
1 parent 4085695 commit 6c27d44

File tree

7 files changed

+35
-21
lines changed

7 files changed

+35
-21
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ jobs:
2222
uses: Swatinem/rust-cache@v2
2323
- uses: taiki-e/install-action@v2
2424
with: { tool: 'just,cargo-binstall' }
25-
- if: github.event_name == 'release'
26-
name: Ensure this crate has not yet been published (on release)
27-
run: just check-if-published
2825
- run: just ci-test
29-
- name: Check semver
30-
uses: obi1kenobi/cargo-semver-checks-action@v2
3126

3227
test-nightly:
3328
name: Nightly-specific tests

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,4 @@ cast_sign_loss = "allow"
4545
missing_errors_doc = "allow"
4646
missing_panics_doc = "allow"
4747
must_use_candidate = "allow"
48-
needless_range_loop = "allow"
49-
precedence = "allow"
5048
unreadable_literal = "allow"

justfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ features_flag := '--all-features'
77
# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
88
# Use `just env-info` to see the current values of RUSTFLAGS and RUSTDOCFLAGS
99
ci_mode := if env('CI', '') != '' {'1'} else {''}
10+
# cargo-binstall needs a workaround due to caching
11+
# ci_mode might be manually set by user, so re-check the env var
12+
binstall_args := if env('CI', '') != '' {'--no-track'} else {''}
1013
export RUSTFLAGS := env('RUSTFLAGS', if ci_mode == '1' {'-D warnings'} else {''})
1114
export RUSTDOCFLAGS := env('RUSTDOCFLAGS', if ci_mode == '1' {'-D warnings'} else {''})
1215
export RUST_BACKTRACE := env('RUST_BACKTRACE', if ci_mode == '1' {'1'} else {''})
@@ -16,7 +19,7 @@ export RUST_BACKTRACE := env('RUST_BACKTRACE', if ci_mode == '1' {'1'} else {''}
1619

1720
# Run integration tests and save its output as the new expected output
1821
bless *args: (cargo-install 'cargo-insta')
19-
TRYBUILD=overwrite cargo insta test --accept --unreferenced=delete --all-features
22+
cargo insta test --accept --unreferenced=delete {{features_flag}} {{args}}
2023

2124
# Build the project
2225
build:
@@ -58,6 +61,7 @@ docs *args='--open':
5861
# Print environment info
5962
env-info:
6063
@echo "Running {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
64+
@echo "PWD $(pwd)"
6165
{{just_executable()}} --version
6266
rustc --version
6367
cargo --version
@@ -93,6 +97,7 @@ get-msrv package=main_crate: (get-crate-field 'rust_version' package)
9397
msrv: (cargo-install 'cargo-msrv')
9498
cargo msrv find --write-msrv --component rustfmt {{features_flag}} --ignore-lockfile -- {{just_executable()}} ci-test-msrv
9599

100+
# Run cargo-release
96101
release *args='': (cargo-install 'release-plz')
97102
release-plz {{args}}
98103

@@ -112,6 +117,10 @@ test-doc: (docs '')
112117
test-fmt: && (fmt-toml '--check' '--check-format')
113118
cargo fmt --all -- --check
114119

120+
# Use the experimental workspace publishing with --dry-run. Requires nightly Rust.
121+
test-publish:
122+
cargo +nightly -Z package-workspace publish --dry-run
123+
115124
# Find unused dependencies. Install it with `cargo install cargo-udeps`
116125
udeps: (cargo-install 'cargo-udeps')
117126
cargo +nightly udeps --workspace --all-targets {{features_flag}}
@@ -150,7 +159,7 @@ cargo-install $COMMAND $INSTALL_CMD='' *args='':
150159
echo "$COMMAND could not be found. Installing it with cargo install ${INSTALL_CMD:-$COMMAND} --locked {{args}}"
151160
cargo install ${INSTALL_CMD:-$COMMAND} --locked {{args}}
152161
else
153-
echo "$COMMAND could not be found. Installing it with cargo binstall ${INSTALL_CMD:-$COMMAND} --locked {{args}}"
154-
cargo binstall ${INSTALL_CMD:-$COMMAND} --locked {{args}}
162+
echo "$COMMAND could not be found. Installing it with cargo binstall ${INSTALL_CMD:-$COMMAND} {{binstall_args}} --locked {{args}}"
163+
cargo binstall ${INSTALL_CMD:-$COMMAND} {{binstall_args}} --locked {{args}}
155164
fi
156165
fi

src/rust/bytebuffer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ impl IntBuffer {
107107
// FIXME: why is self not used here??
108108
assert!(offset + length as usize <= src.len(), "Buffer underflow");
109109
let mut result: Vec<u8> = vec![];
110-
for i in offset..offset + length as usize {
111-
result.extend_from_slice(&src[i].to_le_bytes());
110+
for value in &src[offset..offset + (length as usize)] {
111+
result.extend_from_slice(&value.to_le_bytes());
112112
}
113113
result
114114
}

src/rust/integer_compression/bitpacking.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,7 @@ pub fn fast_unpack(input: &[u32], inpos: usize, output: &mut [u32], outpos: usiz
13391339
}
13401340

13411341
fn fast_unpack0(output: &mut [u32], outpos: usize) {
1342-
for i in outpos..outpos + 32 {
1343-
output[i] = 0;
1344-
}
1342+
output[outpos..outpos + 32].fill(0);
13451343
}
13461344

13471345
fn fast_unpack1(input: &[u32], inpos: usize, output: &mut [u32], outpos: usize) {

tests/basic_tests.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![cfg(feature = "rust")]
2+
#![allow(clippy::needless_range_loop)]
23

34
use std::io::Cursor;
45

@@ -36,7 +37,7 @@ fn saul_test() {
3637
&mut output_offset,
3738
)
3839
.unwrap_or_else(|e| {
39-
panic!("Failed to compress with {}: {:?}", codec.name(), e);
40+
panic!("Failed to compress with {}: {e:?}", codec.name());
4041
});
4142

4243
let len = output_offset.position() as u32 - x;
@@ -51,7 +52,7 @@ fn saul_test() {
5152
&mut Cursor::new(0),
5253
)
5354
.unwrap_or_else(|e| {
54-
panic!("Failed to uncompress with {}: {:?}", codec.name(), e);
55+
panic!("Failed to uncompress with {}: {e:?}", codec.name());
5556
});
5657

5758
assert_eq!(input, answer);
@@ -81,7 +82,7 @@ fn test_varying_length() {
8182
&mut Cursor::new(0),
8283
)
8384
.unwrap_or_else(|e| {
84-
panic!("Failed to compress with {}: {:?}", codec.name(), e);
85+
panic!("Failed to compress with {}: {e:?}", codec.name());
8586
});
8687
let mut answer = vec![0; l + 1024];
8788
codec
@@ -93,7 +94,7 @@ fn test_varying_length() {
9394
&mut Cursor::new(0),
9495
)
9596
.unwrap_or_else(|e| {
96-
panic!("Failed to uncompress with {}: {:?}", codec.name(), e);
97+
panic!("Failed to uncompress with {}: {e:?}", codec.name());
9798
});
9899
for k in 0..l {
99100
assert_eq!(answer[k], data[k]);
@@ -122,7 +123,7 @@ fn test_varying_length_two() {
122123
&mut Cursor::new(0),
123124
)
124125
.unwrap_or_else(|e| {
125-
panic!("Failed to compress with {}: {:?}", codec.name(), e);
126+
panic!("Failed to compress with {}: {e:?}", codec.name());
126127
});
127128
let mut answer = vec![0; data_copy.len() + 1024];
128129
codec
@@ -134,7 +135,7 @@ fn test_varying_length_two() {
134135
&mut Cursor::new(0),
135136
)
136137
.unwrap_or_else(|e| {
137-
panic!("Failed to uncompress with {}: {:?}", codec.name(), e);
138+
panic!("Failed to uncompress with {}: {e:?}", codec.name());
138139
});
139140
for k in 1..l {
140141
if answer[k] != data[k] {

tomlfmt.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
table_order = [
2+
'package',
3+
'lib',
4+
'bin',
5+
'example',
6+
'bench',
7+
'features',
8+
'dependencies',
9+
'build-dependencies',
10+
'dev-dependencies',
11+
'profile',
12+
'lints',
13+
]

0 commit comments

Comments
 (0)