Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Seven terms have exactly one meaning each, everywhere in this repository: code c

- If Cargo rejects a dependency cycle, the design is wrong, not the graph.
- Pseudo-random test input comes only from a fixed seed that the failure prints. Temporary directory names come from the test's name, the process id, and a counter.
- A file holds one concept and has no length limit. Split a file only when it holds a second unrelated concept. Size limits sit on functions and types, and clippy and `cargo test -p build-xtask` enforce them. Split an oversized type by responsibility; a new entry in the allowlist in `crates/build-xtask/src/type_size.rs` is a plan decision with a reason, never a way to make a change pass.
- 1 file holds 1 domain concept with no length limit. Split a file only when it holds a second unrelated concept.
- Production code uses the standard module layout: `foo.rs`, with `foo/bar.rs` for its children. No `#[path]`, and no inline `mod` blocks. A module never has exactly one child file (tests aside): merge it, or make it a peer module `foo_bar.rs` declared beside `foo.rs`.
- Test code goes at the bottom of the file under test in a `#[cfg(test)] mod tests { }` block when practical (if in doubt, beside), and otherwise in `foo-tests.rs` beside it, wired with `#[path = "foo-tests.rs"] mod tests;`. A big test file may split by topic into siblings named after it, `<stem>-<topic>.rs` (so `foo-tests-topic.rs`). These are the only files wired with `#[path]`, so a hyphen in a file name means test code. Top-level `tests/` and `benches/` trees follow Cargo's conventions.
- The crates in this repository keep their older layout until their own pass.
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,5 @@ doc_markdown = "allow"
# `assert_eq!(x, [] as [T; 0])`, which has to spell out the element type and
# needs `T: PartialEq + Debug`, so it cannot be applied to most call sites.
assert_is_empty = "allow"
too_many_lines = "allow"
too_many_arguments = "allow"
5 changes: 0 additions & 5 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
allow-unwrap-in-tests = true
allow-expect-in-tests = true

# Size limits sit on functions (here) and on types (build-xtask's
# type-size check). A file has no length limit.
too-many-lines-threshold = 100
too-many-arguments-threshold = 7

# Process-global installers. Only a binary entry point may call one, under
# `#[expect(clippy::disallowed_methods, reason = ...)]`. No entry names a
# `replacement`, because no alternative takes the same arguments and returns
Expand Down
1 change: 0 additions & 1 deletion crates/build-xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ mod new_crate;
mod no_doctests;
mod product;
mod tidy;
mod type_size;
mod unsafe_allowlist;

use std::path::Path;
Expand Down
6 changes: 2 additions & 4 deletions crates/build-xtask/src/tidy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
//! the product boundary (run from `product`), the pin on the crates that
//! come from runvil-harness (run from `harness_pin`), the doctest ban over
//! every workspace crate (run from `no_doctests`), the `Debug` trait's one
//! spelling over every workspace crate (run from `debug_spelling`), the
//! unsafe allowlist (run from `unsafe_allowlist`), and the type-size
//! limits over every workspace crate (run from `type_size`).
//! spelling over every workspace crate (run from `debug_spelling`), and the
//! unsafe allowlist (run from `unsafe_allowlist`).
//!
//! Each check returns a list of human-readable violations. The `#[test]`
//! wrappers assert the lists are empty, so `cargo test -p build-xtask`
Expand Down Expand Up @@ -68,7 +67,6 @@ pub(crate) fn all_violations(root: &Path) -> Vec<String> {
violations.extend(crate::harness_pin::harness_pin_violations(root));
violations.extend(crate::no_doctests::no_doctests_violations(root));
violations.extend(crate::debug_spelling::debug_spelling_violations(root));
violations.extend(crate::type_size::type_size_violations(root));
violations
}

Expand Down
Loading
Loading