Skip to content

build on current Rust, clean up clippy/fmt, and add GitHub Actions CI - #3

Open
asiniscalchi wants to merge 4 commits into
Project-CETI:mainfrom
asiniscalchi:refactoring/fix_compilation_and_ci
Open

build on current Rust, clean up clippy/fmt, and add GitHub Actions CI#3
asiniscalchi wants to merge 4 commits into
Project-CETI:mainfrom
asiniscalchi:refactoring/fix_compilation_and_ci

Conversation

@asiniscalchi

Copy link
Copy Markdown

The crate no longer built on a current stable toolchain. This PR fixes the build,
resolves every clippy finding (a few of which were real bugs), formats the codebase
with rustfmt, and adds a CI workflow that keeps all of it enforced.

Build fixes

  • Remove the stale [[bin]] hello entry from Cargo.tomlsrc/hello/ was deleted
    long ago and the dangling entry made every cargo invocation fail target resolution.
  • Fix two dangerous_implicit_autorefs hard errors in audio.rs (deny-by-default on
    recent toolchains) by making the reference through the shared-memory pointer explicit.
  • Rename .cargo/config.cargo/config.toml (deprecated name, contents unchanged).

Real bugs surfaced by clippy

  • Missing NUL terminators: the light, pressure, and all IMU shm/semaphore name
    constants in ceti.rs were built from byte literals without a trailing \0, so
    shm_open/sem_open would read past the end of the literal. All C-string constants
    now use c"..." literals, which are NUL-terminated by construction.
  • Ignored read length in the TCP command handler (subscription.rs): commands were
    parsed from the full 1500-byte buffer including uninitialized tail; now only the bytes
    actually received are parsed.
  • Unchecked write calls in the example client replaced with write_all, and an
    always-false size <= 0 comparison on an unsigned value fixed.

Cleanup

  • cargo clippy --fix for the mechanical findings (unneeded returns, div_ceil,
    needless borrows) plus removal of dead code and dead stores.
  • #[allow(clippy::too_many_arguments)] on tcp_handler (one subscriber list per
    sensor stream) and a SubscriberList type alias in fwd_thread.rs.
  • cargo fmt over the whole codebase (whitespace-only; the large subscription.rs
    diff is rustfmt re-nesting the match arms).
    ## CI (.github/workflows/ci.yml)

Two jobs on push to main and on PRs:

  1. Build & test (x86_64)cargo fmt --check, build all targets (installs
    libasound2-dev for the rodio example), cargo clippy --all-targets -- -D warnings, cargo test.
  2. Cross-compile daemon (aarch64) — release build for the whale tag using Ubuntu's
    gcc-aarch64-linux-gnu (linker overridden via env var, taking precedence over
    .cargo/config.toml), with the resulting daemon-aarch64 binary uploaded as a workflow artifact on every run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant