Skip to content

ci: add format and lint gates; trim the package; forbid unsafe code - #9

Open
zancas wants to merge 3 commits into
mainfrom
chore/lint-gates-and-package-trim
Open

zancas wants to merge 3 commits into
mainfrom
chore/lint-gates-and-package-trim

Conversation

@zancas

@zancas zancas commented Nov 12, 2026

Copy link
Copy Markdown
Member

What

This pull request is a follow-up to PR #8 "feat: expose GetStandardFee (upstream v0.6.0); bump to 0.5.0". It makes three changes, one in each commit. It does not change the public API of the crate.

Format gate and lint gate in CI

The job check and test now runs cargo fmt --check. It also runs cargo clippy --all-targets -- --deny warnings.

Both commands failed on main before this change. The formatter changed one statement in build.rs. Clippy reported 21 double_must_use warnings. All 21 warnings are in the generated bindings, which must not be edited by hand. The rpc module in src/lib.rs now has #[allow(clippy::double_must_use)]. The attribute permits that one lint on that one module only.

Package contents

Cargo.toml now excludes Makefile and from_darkside_tests_build.rs from the published package. The Makefile works only in a clone of the repository. The file from_darkside_tests_build.rs is not compiled, and it names proto paths that do not exist in this repository. Both files stay in the repository.

The file darksiderpc/darkside.proto is still in the package. This pull request does not change that.

Unsafe code

src/lib.rs and build.rs now start with #![forbid(unsafe_code)]. The generated bindings compile with this attribute.

Verification

All steps of the two CI jobs pass locally on this branch.

  • cargo fmt --check passes.
  • cargo check --locked --all-targets passes.
  • cargo clippy --locked --all-targets -- --deny warnings passes.
  • cargo nextest run --locked passes with 4 tests.
  • cargo build --locked --features rebuild-proto leaves src/generated unchanged.

cargo package --list shows that the two excluded files are no longer in the package.

🤖 Generated with Claude Code

zancas and others added 3 commits November 11, 2026 18:33
The CI workflow left out `cargo fmt --check` and `cargo clippy` because
both failed on main. The formatter wanted one statement in build.rs
joined onto a single line. Clippy reported 21 double_must_use warnings,
all in the generated bindings, where async_trait expands each server
trait method into a must_use function that returns a must_use future.

This change formats build.rs. It allows clippy::double_must_use on the
rpc module that includes the generated file, because that file is
generator output and the bindings job rejects any hand edit to it. The
allow covers that one lint on that one module, so every other lint
still applies to the generated code.

With both tools clean, the check-and-test job now runs
`cargo fmt --check` and `cargo clippy --all-targets -- --deny warnings`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`cargo package --list` showed two files in the published package that
no user of the crate can use. The Makefile drives `git subtree pull`,
which works only in a clone of the repository. The file
from_darkside_tests_build.rs is a build script copied from another
repository; it names proto paths that do not exist here, and nothing
compiles it.

This change adds both files to the exclude list in Cargo.toml. Both
stay in the repository.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Neither crate root declared a position on unsafe code. The library
holds only generated prost and tonic bindings and three re-exports, and
the build script only invokes the generator, so neither needs unsafe.

This change adds `#![forbid(unsafe_code)]` to src/lib.rs and to
build.rs. The attribute is forbid, not deny, so no inner scope can
override it. The generated bindings compile under it, which shows that
they contain no unsafe block.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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