Skip to content

New lint: Puncuate end of sentences. #8371

@i509VCB

Description

@i509VCB

What it does

This lint suggests to end a sentence with punctuation if there is a newline gap, (two \n\n) or the doc comment ends.

Lint Name

puncuate_end_sentence

Category

pedantic

Advantage

  • Documentation is made clearer with punctuation at the end of short sentences and long paragraphs.

Drawbacks

  • This lint only works for the end of documentation or where a new line gap is present. Otherwise we would have to embed a grammar engine into clippy.
  • This lint is not easily applicable in languages that are not descended from Latin (hence the pedantic category).

Example

/// Returns the meaning of life
fn meaning_of_life() -> u32 {
    42
}

Could be written as:

/// Returns the meaning of life.
fn meaning_of_life() -> u32 {
    42
}

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