docs(skills): split build style rules

This commit is contained in:
2026-09-17 12:37:28 -04:00
parent 08e70fb54c
commit 5aa49ce726
2 changed files with 26 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
# Rust build rules
# Dependency rules
## Use workspace dependency versions
@@ -28,27 +28,3 @@ Apply this rule to `rust_library`, `rust_binary`, and `rust_test` targets.
Cargo and Bazel resolve Rust dependencies independently.
Complete declarations keep `cargo check`, Rust Analyzer, and Bazel builds consistent.
## Declare Rust tests in Bazel
### Rule
Declare Rust test files in the nearest Bazel `BUILD` file with `rust_test`.
Do not add `[[test]]` entries to `Cargo.toml` unless the operator explicitly requests Cargo test declarations.
### Rationale
Bazel is the source of truth for Rust test targets in this repository.
Keeping test declarations in Bazel avoids duplicate test target lists.
## Use one source input style per `rust_test`
### Rule
Do not set both `crate` and `srcs` on a `rust_test` target.
Use exactly one input style for each Rust test target.
### Rationale
`rules_rust` rejects `rust_test` targets that set both `crate` and `srcs`.
Keeping one input style per target makes the test declaration valid and unambiguous.

View File

@@ -0,0 +1,25 @@
# Test rules
## Declare Rust tests in Bazel
### Rule
Declare Rust test files in the nearest Bazel `BUILD` file with `rust_test`.
Do not add `[[test]]` entries to `Cargo.toml` unless the operator explicitly requests Cargo test declarations.
### Rationale
Bazel is the source of truth for Rust test targets in this repository.
Keeping test declarations in Bazel avoids duplicate test target lists.
## Use one source input style per `rust_test`
### Rule
Do not set both `crate` and `srcs` on a `rust_test` target.
Use exactly one input style for each Rust test target.
### Rationale
`rules_rust` rejects `rust_test` targets that set both `crate` and `srcs`.
Keeping one input style per target makes the test declaration valid and unambiguous.