-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
When a rustdoc comment contains two trailing spaces for a Markdown hard line break, the lint should suggest using a trailing backslash (\
) instead.
rustdoc uses CommonMark, and it allows using \
for hard line breaks, see the specification.
Advantage
A trailing \
makes the intention for a hard line break clearer than two trailing spaces, which can be difficult to notice in Git diffs, and might be removed accidentally during refactoring.
Drawbacks
- The choice whether to use two spaces or a
\
is subjective
(this could be solved by adding the lint toclippy::pedantic
) - If there is not actually a need for a hard line break (e.g. if a
> ...
follows), then the\
might be shown literally (CommonMark example)
Example
/// First line··
/// Second line
fn foo() {}
(·
indicating a space)
Could be written as:
/// First line\
/// Second line
fn foo() {}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints