Skip to content

Commit c974cca

Browse files
authored
Rollup merge of #3509 - phansch:fix_doc_markdown_bugs, r=flip1995
Fix doc_markdown off by one issue Fixes #2210
2 parents f5d6aca + 1cfbadb commit c974cca

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

clippy_lints/src/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn check_doc<'a, Events: Iterator<Item = (usize, pulldown_cmark::Event<'a>)>>(
238238
}
239239

240240
fn check_text(cx: &EarlyContext<'_>, valid_idents: &[String], text: &str, span: Span) {
241-
for word in text.split_whitespace() {
241+
for word in text.split(|c: char| c.is_whitespace() || c == '\'') {
242242
// Trim punctuation as in `some comment (see foo::bar).`
243243
// ^^
244244
// Or even as in `_foo bar_` which is emphasized.

tests/ui/doc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,7 @@ fn issue_1832() {}
177177

178178
/// Ok: CamelCase (It should not be surrounded by backticks)
179179
fn issue_2395() {}
180+
181+
/// An iterator over mycrate::Collection's values.
182+
/// It should not lint a `'static` lifetime in ticks.
183+
fn issue_2210() {}

tests/ui/doc.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,11 @@ error: you should put bare URLs between `<`/`>` or make a proper Markdown link
180180
175 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
181181
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
182182

183-
error: aborting due to 30 previous errors
183+
error: you should put `mycrate::Collection` between ticks in the documentation
184+
--> $DIR/doc.rs:181:22
185+
|
186+
181 | /// An iterator over mycrate::Collection's values.
187+
| ^^^^^^^^^^^^^^^^^^^
188+
189+
error: aborting due to 31 previous errors
184190

0 commit comments

Comments
 (0)