Skip to content

Commit b116c86

Browse files
authored
Merge pull request #463 from CosmWasm/increase-clippy-testing
Create separate libwasmvm_clippy CI job and test more recent clippy versions
2 parents 738c647 + 4e90c05 commit b116c86

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

.circleci/config.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
command: rustc --version; cargo --version; rustup --version
1616
- run:
1717
name: Add Rust components
18-
command: rustup component add clippy rustfmt
18+
command: rustup component add rustfmt
1919
- restore_cache:
2020
keys:
2121
- cargocache-v3-libwasmvm_sanity-rust:1.67.0-{{ checksum "libwasmvm/Cargo.lock" }}
@@ -39,10 +39,6 @@ jobs:
3939
name: Check Rust formatting
4040
working_directory: libwasmvm
4141
command: cargo fmt -- --check
42-
- run:
43-
name: Run linter
44-
working_directory: libwasmvm
45-
command: cargo clippy --all-targets -- -D warnings
4642
- run:
4743
name: Run unit tests
4844
working_directory: libwasmvm
@@ -68,6 +64,39 @@ jobs:
6864
- libwasmvm/target/release/deps
6965
key: cargocache-v3-libwasmvm_sanity-rust:1.67.0-{{ checksum "libwasmvm/Cargo.lock" }}
7066

67+
libwasmvm_clippy:
68+
parameters:
69+
rust-version:
70+
type: string
71+
docker:
72+
- image: rust:<< parameters.rust-version >>
73+
steps:
74+
- checkout
75+
- run:
76+
name: Version information
77+
command: rustc --version && cargo --version
78+
- restore_cache:
79+
keys:
80+
- v3-libwasmvm_clippy-rust:<< parameters.rust-version >>-{{ checksum "libwasmvm/Cargo.lock" }}
81+
- v3-libwasmvm_clippy-rust:<< parameters.rust-version >>-
82+
- run:
83+
name: Add clippy component
84+
command: rustup component add clippy
85+
- run:
86+
name: Run clippy
87+
working_directory: libwasmvm
88+
command: cargo clippy --all-targets -- -D warnings
89+
- save_cache:
90+
paths:
91+
- ~/.cargo/registry
92+
- libwasmvm/target/debug/.fingerprint
93+
- libwasmvm/target/debug/build
94+
- libwasmvm/target/debug/deps
95+
- libwasmvm/target/release/.fingerprint
96+
- libwasmvm/target/release/build
97+
- libwasmvm/target/release/deps
98+
key: v3-libwasmvm_clippy-rust:<< parameters.rust-version >>-{{ checksum "libwasmvm/Cargo.lock" }}
99+
71100
# This performs all the Rust debug builds on Windows. Similar to libwasmvm_sanity
72101
# but avoids duplicating things that are not platform dependent.
73102
libwasmvm_sanity_windows:
@@ -387,6 +416,11 @@ workflows:
387416
- libwasmvm_sanity
388417
# Temporarily disabled. This check is still running on main.
389418
# - libwasmvm_sanity_windows
419+
- libwasmvm_clippy:
420+
matrix:
421+
parameters:
422+
# Run with MSRV and some modern stable Rust
423+
rust-version: ["1.67.0", "1.73.0"]
390424
- libwasmvm_audit
391425
- format-go
392426
- wasmvm_no_cgo

libwasmvm/src/error/rust.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,8 @@ mod tests {
297297

298298
#[test]
299299
fn from_std_str_utf8error_works() {
300-
let error: RustError = str::from_utf8(b"Hello \xF0\x90\x80World")
301-
.unwrap_err()
302-
.into();
300+
let broken = b"Hello \xF0\x90\x80World";
301+
let error: RustError = str::from_utf8(broken).unwrap_err().into();
303302
match error {
304303
RustError::InvalidUtf8 { msg, .. } => {
305304
assert_eq!(msg, "invalid utf-8 sequence of 3 bytes from index 6")

0 commit comments

Comments
 (0)