fix: too_long_first_doc_paragraph suggests wrongly when first line too long (#14276)
Fixes #14274 changelog: [`too_long_first_doc_paragraph`]: fix wrong suggestion when first line too long
This commit is contained in:
commit
0fa170621d
3 changed files with 21 additions and 1 deletions
|
|
@ -51,7 +51,11 @@ pub(super) fn check(
|
|||
// We make this suggestion only if the first doc line ends with a punctuation
|
||||
// because it might just need to add an empty line with `///`.
|
||||
should_suggest_empty_doc = doc.ends_with('.') || doc.ends_with('!') || doc.ends_with('?');
|
||||
} else if spans.len() == 2 {
|
||||
// We make this suggestion only if the second doc line is not empty.
|
||||
should_suggest_empty_doc &= !doc.is_empty();
|
||||
}
|
||||
|
||||
let len = doc.chars().count();
|
||||
if len >= first_paragraph_len {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue