Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

chore(rust): document every unsafe block and lint for it (#276)

2 months ago

b0c5d14
Authored
Davy7/26/2026, 10:54:20 PM
* docs: correct the developer-facing docs that had drifted

The pull request template was a Go project's - go test -race, go vet,
gofmt, and a --json CLI contract that does not exist here. Replaced with
the checks this repo actually runs.

README and README_CN claimed pnpm 10+; package.json pins pnpm@11.13.0
and requires ">=11 <12", so following the README could not install.

README_CN was missing five features README lists - streaming playback,
remote repositories, playlists and singer rotation, lyrics romanization,
and AirPlay casting. Both lists are 17 entries now.

CONTRIBUTING described only cargo clippy / cargo fmt / cargo test. It
never mentioned the frontend commands, nextest, the i18n check, the
contract-doc rule, that the git hooks already run most of it, or
./scripts/setup.sh, which local dev needs.

* chore(rust): document every unsafe block and lint for it

23 of the 33 unsafe blocks carried no SAFETY comment, which is what the
Rust guidelines ask for and what makes an FFI boundary reviewable. The
undocumented ones were the AirPlay bridge, the macOS import picker, and
the Windows Credential Manager wrapper - exactly the places where the
invariant being relied on is not visible from the call site.

Each block now states the invariant it depends on: who owns the pointer,
how long it stays alive, and which earlier check makes the cast or the
index sound. Nothing was rewritten to be "safer"; the comments describe
what the code already relies on.

clippy::undocumented_unsafe_blocks = "warn" in [lints.clippy] keeps it
true. CI runs clippy with -D warnings, so a new undocumented block fails
the build rather than landing unnoticed.

Parent7cd7c73

6 files changed
  • src-tauri/Cargo.toml+7−0
  • src-tauri/src/airplay_stream.rs+15−0
  • src-tauri/src/commands/airplay.rs+10−0
  • src-tauri/src/commands/import/mod.rs+11−0
  • src-tauri/src/system_credentials.rs+17−0
  • src-tauri/tests/phase7_spectral_bench.rs+1−0