Skip to content

doc_markdown: split words on { and }#16838

Closed
barry3406 wants to merge 1 commit intorust-lang:masterfrom
barry3406:fix/doc-markdown-adjacent-braces
Closed

doc_markdown: split words on { and }#16838
barry3406 wants to merge 1 commit intorust-lang:masterfrom
barry3406:fix/doc-markdown-adjacent-braces

Conversation

@barry3406
Copy link
Copy Markdown

@barry3406 barry3406 commented Apr 10, 2026

Fixes #16819

When two brace-delimited items are separated by . (e.g. {SymbolA}.{symbol_b}), the word splitter only broke on whitespace and ', so the whole sequence was tokenized as a single word. After trimming non-alphanumeric chars from the ends, that left SymbolA}.{symbol_b, which has_underscore then matched and the lint wrapped the entire span in one pair of backticks.

Treating { and } as word boundaries makes each braced item get processed independently — same as if there had been whitespace between them.

Before

38 - /// We have {SymbolA}.{symbol_b}.
38 + /// We have {`SymbolA}.{symbol_b`}.
                          ^^^

After

38 - /// We have {SymbolA}.{symbol_b}.
38 + /// We have {`SymbolA`}.{`symbol_b`}.

The case with whitespace between the braces ({SymbolA} and {symbol_b}) was already being handled correctly and continues to work — the regression test covers both shapes.

changelog: [doc_markdown]: correctly handle adjacent brace-delimited items separated by .

Adjacent brace-delimited items separated by `.` (e.g.
`{SymbolA}.{symbol_b}`) were tokenized as a single word, so the
suggestion ended up wrapping both items in one pair of backticks
(``{`SymbolA}.{symbol_b`}``).

Treat `{` and `}` as word boundaries alongside whitespace and `'`,
so each braced item is processed independently.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

Some changes occurred in clippy_lints/src/doc

cc @notriddle

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 10, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

r? @samueltardieu

rustbot has assigned @samueltardieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc_markdown: item in documentation is missing backticks broken

3 participants