rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Detect code block marker in docs without "base indentation"

Open ojeda opened this issue 9 months ago • 0 comments

What it does

In the Linux kernel we had some documentation examples added with triple backquotes at the end without indentation.

Such a lint would find a few hits, e.g. there is currently one in core.

Possibly related, at least implementation-wise: https://github.com/rust-lang/rust-clippy/issues/15024 and https://github.com/rust-lang/rust-clippy/issues/15025.

Advantage

  • More consistency in docs.
  • Less time spent by reviewers.

Drawbacks

No response

Example

/// ```
/// fn f() {}
///```

Should be written as:

/// ```
/// fn f() {}
/// ```

ojeda avatar Jun 09 '25 16:06 ojeda