po4yka/rust-skills/rust-lints
Claude Code and agent skill by po4yka/rust-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when editing workspace.lints, clippy.toml, or rustfmt.toml, choosing a rustc, clippy, or rustdoc lint level, rolling out a stricter lint, reviewing an allow or expect suppression, or triaging a red clippy, cargo fmt, or cargo doc gate. Triggers on [lints] workspace = true, -D warnings, CARGO_BUILD_WARNINGS, unfulfilled_lint_expectations, allow_attributes, disallowed-methods, and the clippy msrv. Not for deny.toml license, advisory, or ban policy; use rust-security.
Install
npx vskill@latest install po4yka/rust-skills/rust-lintsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Rust lints
A lint rejects a whole class of defect for every author. A written rule ("no unsafe", "no bare allow") is not enforcement until a lint level or a CI check carries it. Write down only the level that is actually deployed: a document that shows a target level as the current one makes reviewers stop checking what the compiler does not check either. Read references/triage.md when a clippy, cargo fmt, or cargo doc gate is red.
Where lint policy lives
Put every lint level in the workspace root Cargo.toml. Every member inherits it:
Put no lint levels in a member manifest. A per-crate override is invisible to a reader of the root policy, and it drifts.
| File | Owns | |
|---|---|---|
Root Cargo.toml | [workspace.lints.rust], [workspace.lints.clippy], [workspace.lints.rustdoc]; rust-version in [workspace.package], which clippy reads as the MSRV | |
clippy.toml (beside the root manifest) | Thresholds, disallowed methods and types, ident allow-lists, test exemptions | |
rustfmt.toml | Formatting options | |
deny.toml | cargo deny policy. The rust-security skill owns it. |
A crate attribute overrides the inherited level in both directions. A #![warn(lint)] in lib.rs lowers a workspace deny to warn for that crate (verified on 1.98.1). Only forbid cannot be lowered. Restate an inherited lint in source only at the same or a stricter level. To relax a lint in one crate, follow the order in Suppressions.
Verification
While you iterate, run the crate gate from Add a crate. Before a commit or a merge, run the workspace gate:
What each check proves, and what it does not:
--all-featuresis correct only when the features are additive. With mutually exclusive
features, run clippy once per supported feature set, or run cargo hack clippy --each-feature --workspace --all-targets --locked -- -D warnings when cargo-hack is installed. Give cargo doc and the tests the same feature sets as clippy. The cargo-workflows skill owns the feature matrix.
- Clippy does not run rustdoc lints.
[workspace.lints.rustdoc]and
#![deny(rustdoc::broken_intra_doc_links)] act only under cargo doc. On 1.98.1 a broken intra-doc link passes clippy and cargo test --doc, and fails only cargo doc. Without --document-private-items, rustdoc does not resolve the links in the docs of private items (verified on 1.98.1). Without -D warnings, cargo doc also passes warn-level rustdoc lints such as private_intra_doc_links.
- A host run does not lint code behind
#[cfg(target_os = "android")]or another target cfg.
Run cargo clippy --locked --workspace --target <triple> --all-targets -- -D warnings for each shipped target after rustup target add <triple>.
-- -D warningsdoes not denylinker_messages(warn by default since 1.97, outside the
warnings group). Clippy does not link, so only cargo build or cargo test prints linker output. The default policy keeps linker_messages at warn, because linker output changes with the host linker. To fail CI on linker output, run the build or test step with CARGO_BUILD_WARNINGS=deny (1.97+).
- A green gate on one toolchain can go red on the next: a clippy release adds lints to
pedantic and nursery. Pin the toolchain, and re-run the gate after each bump.
cargo fmt --allrewrites every file. Whencargo fmt --all -- --checkis red before your
change, run rustfmt --edition 2024 --config skip_children=true <file> on the changed files only: plain rustfmt <file> also formats each module the file declares (1.99.1). Run the tests again after formatting.
CARGO_BUILD_WARNINGS=deny (or build.warnings = "deny" in .cargo/config.toml) fails a local crate that has lint warnings. It does not change RUSTFLAGS, so the build cache survives; add --keep-going to see the warnings of every crate. It also fails on linker_messages and on cargo doc warnings (both verified on 1.98.1). Cargo older than 1.97 ignores it, and the gate passes silently. Use it only when the pinned toolchain is 1.97 or newer; keep -- -D warnings otherwise. Set CARGO_BUILD_WARNINGS=deny in the CI job environment, not in a checked-in .cargo/config.toml: the config key also turns every local warning into an error while a developer iterates. Do not use RUSTFLAGS=-Dwarnings: it rebuilds every dependency and replaces the rustflags from config files. RUSTDOCFLAGS also replaces build.rustdocflags from config (verified on 1.98.1); when the config sets rustdocflags, use CARGO_BUILD_WARNINGS=deny for the cargo doc line instead.
Audit suppressions after a lint change. Every hit needs reason = "...", and every // TODO(<owner>) needs a tracked follow-up:
The [workspace.lints] table
Read references/workspace-lints.md when you create or change the table. It holds the strict template for a new workspace and the pragmatic baseline for an existing one with a backlog. Climb from the baseline with Add or tighten a lint.
Read references/lint-catalog.md when you must justify a level, pick lints from restriction, add the optional pointer/FFI or async block, or read the binding-layer rules.
clippy.toml
Run cargo clippy --locked --workspace --all-targets after you add a disallowed-methods or disallowed-types entry. Clippy matches the resolved function, not a same-named method on another type. It can ignore a path that it cannot resolve without a warning (<*const T>::read on 1.98.1). Check that the entry fires where you expect.
Keep one clippy.toml, beside the root manifest. Clippy reads only the nearest file: a member's own clippy.toml replaces the root file, and every root key, disallowed-methods included, stops applying to that member (verified on 1.98.1).
With allow-unwrap-in-tests = true, an #[expect(clippy::unwrap_used)] on test code is unfulfilled, and -D warnings fails on it (verified on 1.98.1). Do not add a per-test suppression that the key already covers. The keys cover only #[test] functions and #[cfg(test)] items: not a shared helper module under tests/, and not an examples/ file (see Suppressions).
rustfmt.toml
Use stable options only. A stable toolchain ignores an unstable option with a warning, so the file formats one way on nightly and another on stable, and cargo fmt --check splits the team.
cargo fmt takes each crate's edition from Cargo.toml and ignores edition here. A direct rustfmt call (an editor, a pre-commit hook) reads it. Set edition and style_edition to the workspace steady-state edition, so that cargo fmt and a direct rustfmt sort imports the same way. Without either key, a direct rustfmt call uses style edition 2015. It then sorts use a::{u8x, U8} differently from cargo fmt on an edition-2024 crate, and CI fails on files that look formatted. edition alone also sets the style edition; set both so the intent is explicit. During a staged edition migration, keep both keys at the old edition until the last crate moves; the cargo-workflows skill owns that sequence. Verified on 1.98.1: stable rustfmt accepts style_edition without the unstable-option warning.
deny.toml
cargo deny --config deny.toml --locked check is the supply-chain part of the gate. The rust-security skill owns the deny.toml policy (licenses, advisories, bans, sources, ignore review) and the failure triage.
Crate-level attributes
Put #![forbid(unsafe_code)] in every crate that has no hand-written unsafe, including a crate that calls C through a safe wrapper crate. Set it per crate, never in [workspace.lints.rust]: a workspace forbid cannot be lowered by the one crate that owns unsafe.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rust-lints/SKILL.md
Popularity
- Repository stars
- 2
- Repository forks
- 1
- 7-day trend score
- 5
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/po4yka/rust-skills/rust-lints)