Repository navigation
Commit 05399a9
authored
ci: lint the whole workspace with clippy and add cargo-deny (#407)
## Summary
CI currently runs `cargo clippy -- --D warnings`, which only lints the
root crate with default targets — the `ffi`, `cli` and `uniffi` crates
were never linted. This PR:
- **Widens the CI clippy invocation** to `cargo clippy --workspace
--all-targets -- -D warnings` (and fixes the `--D` → `-D` flag
spelling).
- **Fixes all 49 clippy findings** this surfaced, all in
`ffi/src/lib.rs`:
- Missing `# Safety` doc sections on the 16 online ciphertext FFI
functions (docs added following the file's existing style, including
notes that `OnlineEncryptorLastChunk`/`OnlineDecryptorLastChunk` consume
the handle).
- Doc list continuation-line indentation
(`doc_overindented_list_items`).
- Redundant `as *const u8` pointer casts.
- Manual `% 4 != 0` replaced with `is_multiple_of`.
- For the `mut_mutex_lock` warnings in the chunk functions: take a
shared reference to the mutex and keep `lock()` (like the read-side
accessors) instead of fabricating a `&mut` from the raw handle — the
handle can be used from multiple threads, so the mutex must actually be
acquired.
- **Adds a `cargo_deny` CI job** (advisories, bans, licenses, sources),
installing cargo-deny with `cargo install --locked` — same convention as
cargo-fuzz in the extended fuzzing workflow, no third-party action.
- **Migrates `deny.toml`** from the pre-0.14 schema (which current
cargo-deny rejects) to the current one, keeping the same policy. Two
adjustments so the check passes on today's dependency tree:
- `Zlib` added to the license allow-list (`foldhash`, pulled in via
`blahaj`).
- `RUSTSEC-2024-0436` ignored with a comment: `paste` is an archived
proc-macro dependency; replacing it (e.g. with `pastey`) is left as a
follow-up.
- **Refreshes `Cargo.lock`** to latest compatible versions (~40 bumps,
including zeroize 1.9, rand 0.10.2, getrandom 0.4.3; also consolidates
duplicate crate versions).
- **Migrates the CLI off the base64 crate.** The CLI pinned base64 0.11
(2020); it now uses the library's own
`utils::base64_encode/base64_decode` helpers (which use base64 0.22
internally) and the direct dependency is dropped.
- **Upgrades uniffi from 0.31 to 0.32.** Bindings are generated at build
time, so CI regenerates them with the matching uniffi version. One
adaptation was needed: uniffi 0.32 maps borrowed `&[u8]` arguments to
`java.nio.ByteBuffer` in Kotlin (zero-copy lowering), which would have
broken every Kotlin consumer expecting `ByteArray`. The exported
functions now take owned `Vec<u8>`, which keeps the Kotlin API on
`ByteArray`; Swift (`Data`) and Python (`bytes`) are unaffected either
way.
## Testing
- `cargo clippy --workspace --all-targets -- -D warnings` — clean
- `cargo fmt --all -- --check` — clean
- `cargo deny check` — advisories ok, bans ok, licenses ok, sources ok
- `cargo test --workspace` (excluding fuzz targets) — 134 passed, 0
failed1 parent 6b02fac commit 05399a9
17 files changed
Lines changed: 479 additions & 596 deletions
File tree
- .github/workflows
- formatting/rust
- cli
- src
- ffi/src
- uniffi/devolutions-crypto-uniffi/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
192 | 205 | | |
193 | 206 | | |
194 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
0 commit comments