rust-lang / rust-lang/rust-clippy

Lint the doctests/examples code

Open
#1,599 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

I think it could be interesting to have cargo-clippy (maybe clippy too?) run the lints on the doctests/code examples for rustdoc. I don't know how hard this would be, but maybe some code from rustdoc could be reused to extract the code from the examples?

As clippy allow to keep a good code quality, I'd love to be able to run it on my examples too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating how cargo-clippy or clippy currently processes doctests and code examples, and whether rustdoc exposes reusable extraction code. Define how doctest examples should be linted and verify that the completed change runs the requested lints on those examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.