Rust docs drift
Rimfe parses changed .rs files without compiling them and records the public surface: pub functions, structs, enums, traits and re-exports, clap derive options with their defaults, serde config fields and env::var reads. When a pull request changes one, the docs sections that name it are checked, and a stale line gets a finding.
What Rimfe reads
An item marked pub is exported. Each pull request is compared fact by fact between its base and head, so a renamed function, a new required argument or a changed default is a change Rimfe can name.
| Surface | What is read |
|---|---|
| Public API | pub functions, structs, unions, enums with their variants, traits with their methods, type aliases, const and static items, impl methods, pub use re-exports, pub mod bodies and #[macro_export] macros. //! module docs. |
| CLI | clap #[derive(Parser)] and #[derive(Args)] structs. A field with long or short becomes a --kebab-case option, other fields are positionals. default_value and default_value_t, help from the doc comment, and env = "X". The command name comes from #[command(name = ...)] or the struct name. |
| Config | serde Deserialize structs: field names after rename and after rename_all in kebab-case or camelCase, with default and skip honoured. |
| Env vars | env::var, env::var_os, env! and option_env!, plus a clap field's env. |
| Crates | Cargo.toml dependencies. |
| Deprecations | #[deprecated], with its since and note read. |
Example: a clap default changes
docs/cli.md says --jobs defaults to 4. Rimfe posts a Docs conflict on that line, quoting it beside the attribute, with an edit that sets the value to 8.
- #[arg(long, default_value_t = 4)]+ #[arg(long, default_value_t = 8)] jobs: usize,Example: a public function is renamed
The README example still calls acme::parse_config. The finding reads: Outdated code sample: README.md line 24 uses parse_config, renamed in this pull request.
- pub fn parse_config(path: &Path) -> Result<Config> {+ pub fn load_config(path: &Path) -> Result<Config> {Example: serde renames every key
Adding rename_all changes the key readers write from max_connections to max-connections. The TOML sample in docs/configuration.md still uses the old key, so it is an Outdated code sample. Config keys match snippets in any language.
#[derive(Deserialize)]+ #[serde(rename_all = "kebab-case")] pub struct Pool { max_connections: u32, }Docs tools beside Rust
API reference on docs.rs is built from doc comments, so the pages that drift are the written ones: the README, a docs/ folder, or an mdBook. mdBook chapters are Markdown, so a docsGlobs entry such as book/src/**/*.md brings them into scope. Doc comments are code to Rimfe, and a changed one counts as a docstring change on its item.
Set up a Rust repository
In a workspace, map each crate to its pages, or give each crate its own .rimfe.json. The file applies when Documentation scope is set to .rimfe.json at the PR base.
{ "$schema": "https://rimfe.com/schema/rimfe.json", "docsGlobs": ["README.md", "book/src/**/*.md"], "codeMappings": [ { "source": "crates/acme-cli/**", "target": "book/src/cli.md" }, { "source": "crates/acme-core/src/config.rs", "target": "book/src/configuration.md" } ], "surface": ["ACME_LOG", "--jobs"]}Limits
- clap
Subcommandenums and the builder API (Command::new().arg(...)) are not read as commands. Enum variants still count as public items. - axum, actix-web and Rocket routes produce no route facts; handlers are read as functions.
rename_allstyles other than kebab-case and camelCase are not applied to serde keys.- Code is parsed, never compiled, so items a macro generates are not seen. Files under
tests/and generated files are skipped.
Try it on your next pull request.
Free for public repositories, with unlimited members.
Start free with GitHub