feat(skills): add Rust file naming rules
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
# Bazel rules
|
||||
|
||||
## Keep Rust tests in separate files
|
||||
|
||||
### Rule
|
||||
|
||||
Put Rust tests in separate `*_test.rs` files.
|
||||
Do not add inline `#[cfg(test)]` modules.
|
||||
|
||||
### Rationale
|
||||
|
||||
Separate test files keep production modules focused and match the repository's Bazel test layout.
|
||||
|
||||
## Declare Rust tests in Bazel
|
||||
|
||||
### Rule
|
||||
|
||||
26
src/skills/style/rust/rules/files.md
Normal file
26
src/skills/style/rust/rules/files.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# File rules
|
||||
|
||||
## Avoid generic Rust file names
|
||||
|
||||
### Rule
|
||||
|
||||
Do not name Rust source files `lib.rs` or `main.rs`.
|
||||
Name library crate root files after the crate they define.
|
||||
Name binary crate root files after the binary they define, or use a `_main.rs` suffix.
|
||||
Set explicit Cargo paths and Bazel `srcs` when needed.
|
||||
|
||||
### Rationale
|
||||
|
||||
Generic root names make file search results and review context less clear.
|
||||
Descriptive file names show which crate or binary owns the code.
|
||||
|
||||
## Keep Rust tests in separate files
|
||||
|
||||
### Rule
|
||||
|
||||
Put Rust tests in separate `*_test.rs` files.
|
||||
Do not add inline `#[cfg(test)]` modules.
|
||||
|
||||
### Rationale
|
||||
|
||||
Separate test files keep production modules focused and match the repository's Bazel test layout.
|
||||
Reference in New Issue
Block a user