From 83a5aec8f577d5f8f244c1ea341a3c6645c2fc7b Mon Sep 17 00:00:00 2001 From: alexion Date: Thu, 17 Sep 2026 09:08:32 -0400 Subject: [PATCH] feat(skills): add Rust file naming rules --- src/skills/style/rust/rules/bazel.md | 11 ----------- src/skills/style/rust/rules/files.md | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 src/skills/style/rust/rules/files.md diff --git a/src/skills/style/rust/rules/bazel.md b/src/skills/style/rust/rules/bazel.md index 61a0430..8b5a2d3 100644 --- a/src/skills/style/rust/rules/bazel.md +++ b/src/skills/style/rust/rules/bazel.md @@ -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 diff --git a/src/skills/style/rust/rules/files.md b/src/skills/style/rust/rules/files.md new file mode 100644 index 0000000..e5f33ef --- /dev/null +++ b/src/skills/style/rust/rules/files.md @@ -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.