Rust Lint.instructions
---
description: Microsoft Rust guideline for lint overrides — use #[expect] not #[allow] to prevent stale lint accumulation. Enforced on all Rust source files.
applyTo: "**/*.rs"
---
# Rust Lint Override Guidelines (Microsoft Pragmatic Rust)
## Lint Overrides Should Use `#[expect]` (M-LINT-OVERRIDE-EXPECT)
When overriding project-global lints inside a submodule or item, you should do
so via `#[expect]`, not `#[allow]`.
Expected lints emit a warning if the marked warning was not encountered, thus
preventing the accumulation of stale lints. That said, `#[allow]` lints are
still useful when applied to generated code, and can appear in macros.
Overrides should be accompanied by a `reason`:when to use it
Community prompt sourced from the open-source GitHub repo pngdeity/apm-user-repository (MIT). A "Rust Lint.instructions" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
roleplaycommunitygeneral
source
pngdeity/apm-user-repository · MIT