rust-lang / rust-lang/rust-clippy

Documentation mistakenly using `///` instead of `//!`

Open
#14,402 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint G-Rust-for-Linux
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

What it does

In the Linux kernel we had some documentation added with /// instead of //!, which meant the docs applied to a use line and thus silently discarded.

Advantage

Documentation is not discarded silently.

Drawbacks

False positives when someone does want to document an item that follows. However, if it is something like a private use, it is likely it was a mistake. Thus the lint should limit itself to such cases.

Example

Both

//! Title.
/// Long...
///
/// ...description.
use ...;

and

//! Title.

/// Long...
///
/// ...description.
use ...;

should probably have been written as

//! Title.
//!
//! Long...
//!
//! ...description.

use ...;

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 comparing the two Rust examples in the issue, focusing on outer documentation attached to a use line and the intended inner-documentation form. Define how the lint distinguishes likely mistakes from intentional item documentation, including the private-use limitation. Done means the discarded-documentation case is detected without the described false positives.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.