Prompt file imported from microsoft/oxidizer (
.github/prompts/clippy-nightly.prompt.md). Copyright stays with the author.
Fixing Nightly Clippy Lints with MCP Tools
You are a Rust developer working on a project that uses the nightly toolchain and enforces strict Clippy lints.
Your task is to identify and fix all Clippy warnings and errors using the MCP (Model Context Protocol) tools.
For all requests, you shall use the nightly toolchain named by RUST_NIGHTLY in constants.env and MCP tools to ensure compatibility with the latest features and lints.
Do not use a bare nightly: it floats, and no gate in this repo enforces it.
Note that CI's Clippy gate runs the stable toolchain named by RUST_LATEST, not nightly.
Nightly-only lints are therefore advisory - they surface problems ahead of the gating
toolchain. Do not add #[expect(...)] for a warning only nightly emits; confirm it fires on
RUST_LATEST first, or the expectation becomes unfulfilled once nightly moves on.
Instructions
-
Identify Crates in Your Workspace
- Before starting, ensure you have a clear understanding of the crates in your workspace.
- Create a list of all crates in the workspace by listing directories in
crates/andcrates_internal/directories. - Sort the crates in logical order by crates with least dependencies.
You can get the list of dependencies by running
#cargo-infowithverboseon each crate.
-
Fix Lints Crate by Crate
- For each crate in your workspace, perform the following steps before moving to the next crate.
-
Run Clippy with Nightly Toolchain
- Use the toolchain named by
RUST_NIGHTLYto run Clippy on the current crate. Use the#cargo-clippytool for this, targeting only the specific crate.
- Use the toolchain named by
-
Automatically Fix Lints with
fix- Use the
fixparameter with#cargo-clippyto automatically apply suggested fixes for applicable lints in the current crate. - Review the changes made by the fix process to ensure correctness.
- Use the
-
Analyze Clippy Output
- Review the Clippy output for any remaining warnings or errors in the current crate.
- Pay special attention to lints that are only available on
nightly.
-
Manually Fix Remaining Lints
- For each remaining lint:
- Read the lint message and suggested fix.
- Update your code to resolve the issue.
- Prefer code changes over suppressing lints with
#[allow(...)], unless suppression is justified and documented.
- If a lint is unclear, consult the Clippy documentation for details.
- If a lint suppression is not necessary anymore, remove the
#[expect(...)]attribute from the code.
- For each remaining lint:
-
Verify and Commit
- Re-run Clippy on the current crate to ensure all lints are fixed.
- Run
#cargo-testfor the current crate to verify no regressions. - Commit your changes with a message referencing the lints fixed for that crate.
-
Repeat for All Crates
- Repeat steps 2–6 for each crate in your workspace.
Tips
- Always use the toolchain named by
RUST_NIGHTLYinconstants.envand MCP tools for best results. - Use
all-featuresandall-targetsflags with MCP tools to ensure all lints are checked across all features and targets of the current crate. - If you encounter unstable or experimental lints, document any workarounds or limitations.
Use
#[expect(clippy::lint_name, reason = "")]sparingly and only when absolutely necessary, providing a clear reason.