Clippy lints / Restriction
Clippy lint · Restriction · checked with Clippy 0.1.99
clippy::doc_paragraphs_missing_punctuation: Checks for doc comments whose paragraphs do not end with a period or another punctuation mark. Various Markdowns constructs are taken into account to avoid false positives
What it meansChecks for doc comments whose paragraphs do not end with a period or another punctuation mark. Various Markdowns constructs are taken into account to avoid false positives. It is in the restriction group and off by default.
Does it matter?
A project may wish to enforce consistent doc comments by making sure paragraphs end with a punctuation mark.
Lints that forbid language features for specific codebases (no unwrap, no indexing...). Off by default; pick them one by one, never the whole group.
How to fix it
Clippy does not fix this one automatically (its suggestion may change behaviour, so it only shows it). Change the code by hand:
Flagged
/// Returns a random number
///
/// It was chosen by a fair dice roll
Write this instead
/// Returns a random number.
///
/// It was chosen by a fair dice roll.
Turn it off, or on
It is off by default. To use it, set it to warn or deny:
Whole crate (Cargo.toml)
[lints.clippy]
doc_paragraphs_missing_punctuation = "warn"In code
#![warn(clippy::doc_paragraphs_missing_punctuation)]One run
cargo clippy -- -W clippy::doc-paragraphs-missing-punctuationThe [lints] table needs Rust 1.74 or newer. In a workspace, put it under [workspace.lints.clippy] and add [lints] workspace = true to each member.
Clippy's own documentation
What it does
Checks for doc comments whose paragraphs do not end with a period or another punctuation mark. Various Markdowns constructs are taken into account to avoid false positives.
Why is this bad?
A project may wish to enforce consistent doc comments by making sure paragraphs end with a punctuation mark.
Example
/// Returns a random number
///
/// It was chosen by a fair dice roll
Use instead:
/// Returns a random number.
///
/// It was chosen by a fair dice roll.
Terminal punctuation marks
This lint treats these characters as end markers: ‘.’, ‘?’, ‘!’, ‘…’ and ‘:’.
The colon is not exactly a terminal punctuation mark, but this is required for paragraphs that introduce a table or a list for example.
From the Clippy lint list (0.1.99), part of the Rust project, MIT or Apache-2.0. Official entry.
Related lints
- unwrap_usedChecks for .unwrap() or .unwrap_err() calls on Results and .unwrap() call on Options
- module_name_repetitionsDetects public item names that are prefixed or suffixed by the containing public module’s name
- expect_usedChecks for .expect() or .expect_err() calls on Results and .expect() call on Options
- deref_by_slicingslicing when dereferencing would work
- disallowed_script_identsidentifier `счётчик` has a Unicode script that is not allowed by configuration: Cyrillic
- doc_include_without_cfgChecks if included files in doc comments are included only for cfg(doc)
- else_if_without_else`if` expression with an `else if`, but without a final `else`
- empty_dropempty drop implementation
- empty_enum_variants_with_bracketsenum variant has empty brackets
All 847 Clippy lints · Rust compiler errors · Cargo.toml checker
Up next
Related lintclippy::unwrap_usedChecks for .unwrap() or .unwrap_err() calls on Results and .unwrap() call on OptionsRead it next →Did this answer your question?