Skip to content

Detect extra "base indentation" in Rust code blocks in docs #15025

Open
@ojeda

Description

@ojeda

What it does

For Rust code blocks, and for code blocks in many other languages, it is very likely that extra indentation is not indented if it is applied across the entire contents of the code block, e.g. an extra space on all lines (or even just all non-empty lines).

Having said that, when/if rustfmt stabilizes formatting code blocks in documentation, this lint may not be needed anymore.

Possibly related, at least implementation-wise: #15023 and #15024.

Advantage

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

Drawbacks

No response

Example

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

Should be written as:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions