Skip to content

Extend documentation on snippets#16809

Open
ada4a wants to merge 2 commits intorust-lang:masterfrom
ada4a:snippet-docs
Open

Extend documentation on snippets#16809
ada4a wants to merge 2 commits intorust-lang:masterfrom
ada4a:snippet-docs

Conversation

@ada4a
Copy link
Copy Markdown
Contributor

@ada4a ada4a commented Apr 4, 2026

changelog: none

cc @Jarcho: I do realize you're currently reworking snippets (apparently to a great extent), but I think it'd still be worthwhile to document the current process, because in my experience this is a common struggle point among new contributors. Feel free to just revert these changes in your PR(s), if necessary.

ada4a added 2 commits April 4, 2026 13:09
- replace `.map_or_else()` with if-let-else -- the inline closure was
  just a bit too complex to be readable
- improve the documentation a bit
- In the first suggestion example, use
  `snippet_with_applicability` to correctly adjust applicability. We
  don't want to be giving wrong advice right away.
- Explain when to use `snippet` vs `snippet_with_applicability`
- Recommend using `"_"` as the fallback string most of the time; adjust
  the examples throughout accordingly.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 4, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 4, 2026

r? @flip1995

rustbot has assigned @flip1995.
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: @flip1995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants