Skip to content

Commit

Permalink
Auto merge of #3509 - phansch:fix_doc_markdown_bugs, r=flip1995
Browse files Browse the repository at this point in the history
Fix doc_markdown off by one issue

Fixes #2210
  • Loading branch information
bors committed Dec 12, 2018
2 parents f5d6aca + 1cfbadb commit c60dbb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ fn check_doc<'a, Events: Iterator<Item = (usize, pulldown_cmark::Event<'a>)>>(
}

fn check_text(cx: &EarlyContext<'_>, valid_idents: &[String], text: &str, span: Span) {
for word in text.split_whitespace() {
for word in text.split(|c: char| c.is_whitespace() || c == '\'') {
// Trim punctuation as in `some comment (see foo::bar).`
// ^^
// Or even as in `_foo bar_` which is emphasized.
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ fn issue_1832() {}

/// Ok: CamelCase (It should not be surrounded by backticks)
fn issue_2395() {}

/// An iterator over mycrate::Collection's values.
/// It should not lint a `'static` lifetime in ticks.
fn issue_2210() {}
8 changes: 7 additions & 1 deletion tests/ui/doc.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,11 @@ error: you should put bare URLs between `<`/`>` or make a proper Markdown link
175 | /// Not ok: http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 30 previous errors
error: you should put `mycrate::Collection` between ticks in the documentation
--> $DIR/doc.rs:181:22
|
181 | /// An iterator over mycrate::Collection's values.
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to 31 previous errors

0 comments on commit c60dbb1

Please sign in to comment.