Skip to content

build: deny self-named module files - #6

Merged
npmccallum merged 1 commit into
mainfrom
bot/devtree/deny-self-named-modules
Oct 31, 2026
Merged

npmccallum merged 1 commit into
mainfrom
bot/devtree/deny-self-named-modules

Conversation

@npmccallum

Copy link
Copy Markdown
Contributor

Summary

Set self_named_module_files to deny in clippy (Rust's code checker).
Every pichi-vm crate (a Rust package) uses the same mod.rs layout for
modules that have their own folder, so the code follows one layout.

Fixes #5

Approach

A module is a named part of the code, usually a file or a folder. This
lint (an automatic code check) requires a module with its own folder to
use foo/mod.rs inside that folder, rather than foo.rs beside it.
No source files use the rejected layout.

The setting is in Cargo.toml (the build settings file), beside
pedantic (clippy's extra-strict group of checks). The fuzz project is
for fuzzing, which means feeding random inputs to look for crashes. It
has no lint table, so it is not part of this change.

Verification

  • All local tests were run and passed for every commit in this series independently

The regular test run passed 105 tests, with 0 failed, 0 ignored, and
0 filtered out. The ignored-only run passed 0 tests, with 0 failed,
0 ignored, and 105 filtered out.

The documentation test run passed 1 test, with 0 failed, 1 ignored, and
0 filtered out. The ignored-only documentation run passed that ignored
example: 1 passed, 0 failed, 0 ignored, and 1 filtered out. Both examples
passed across the two runs.

The tests and documentation tests also passed with warnings treated as errors, as the automatic checks do: 105 regular tests passed, the ignored-only run passed 0 with 105 filtered out, the documentation run passed 1 with 1 ignored, and its ignored-only run passed 1 with 1 filtered out, with no failures.

rustfmt, run through cargo fmt (Rust's code formatter), and clippy passed.
cargo-deny (the dependency policy checker), gitlint (the commit message
checker), hawkeye (the license header checker), and actionlint (the
workflow file checker) passed. The whitespace check passed.

Documentation built with docsrs (the setting used when docs.rs builds
the documentation). Fixture regeneration with dtc (the devicetree
compiler) passed and produced matching files.

cargo fuzz (the Rust fuzzing tool) built all targets with nightly (the
preview build of Rust). Each run used a seeded corpus (the saved set of
sample inputs a fuzzer starts from). Each target ran with a 60-second
limit; the fuzzer reported 61 elapsed seconds for each run.
fuzz_parse completed 2,378,477 runs, fuzz_overlay completed
1,562,227 runs, and fuzz_owned completed 1,823,829 runs.
All three passed with no crashes and no crash artifacts.

A test file placed beside a same-named folder makes clippy fail.

Turn on clippy's self_named_module_files check as an error. Clippy
is Rust's code checker. A module is a named part of the code,
usually a file or a folder, and a crate is a Rust package.

With this check, a module that has its own folder puts its code in
foo/mod.rs inside that folder, not in a foo.rs file beside it. Every
pichi-vm crate uses this same layout. No source files use the
rejected layout.

Fixes #5
@npmccallum
npmccallum merged commit 8304033 into main Oct 31, 2026
8 checks passed
@npmccallum
npmccallum deleted the bot/devtree/deny-self-named-modules branch October 31, 2026 15:22
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.

Use the mod.rs layout for every module

1 participant