Skip to content

{BTree,Hash}Map: add "Entry API" section heading - #145162

Merged
bors merged 2 commits into
rust-lang:masterfrom
ada4a:hash_and_btree_map-add-entry-section
Aug 10, 2025
Merged

{BTree,Hash}Map: add "Entry API" section heading#145162
bors merged 2 commits into
rust-lang:masterfrom
ada4a:hash_and_btree_map-add-entry-section

Conversation

@ada4a

@ada4aada4a commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

I wanted to link to an introduction of the Entry API to the help message of clippy::map_entry (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the Entry enum itself a bit short. On the other hand, {BTree,Hash}Map both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "Entry API" section heading to both of them.

Do let me know whether you think this is the right approach.

@rustbot

Copy link
Copy Markdown
Collaborator

r? @tgross35

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

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 9, 2025
@joshtriplett

Copy link
Copy Markdown
Member

In general, this seems like a good idea.

The only issue I see that needs fixing before merging this: In HashMap, there's another section just below this that needs a heading to separate it from this new section; it starts with /// The easiest way to use HashMap with a custom key type is.

Add another ## heading with an appropriate section title right before that line, and then r=me.

@ada4a
ada4aforce-pushed the hash_and_btree_map-add-entry-section branch from 4737992 to 06e4365CompareAugust 9, 2025 17:42
@ada4aada4a changed the title {BTree,Hash}Map: add "Entry API" section header{BTree,Hash}Map: add "Entry API" section headingAug 9, 2025
@ada4a

ada4a commented Aug 9, 2025

Copy link
Copy Markdown
ContributorAuthor

thanks for a quick review!

heading

🤦 I always mix up the two terms

Added a new section to HashMap, see if you like it. I thought about calling it just "Custom Keys" for brevity, but that sounded a bit too vague imo

@joshtriplett

Copy link
Copy Markdown
Member

Looks good to me!

@bors r+ rollup

@bors

bors commented Aug 9, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 06e4365 has been approved by joshtriplett

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 9, 2025
@joshtriplett

Copy link
Copy Markdown
Member

🤦 I always mix up the two terms

It doesn't help that sometimes they both apply. The # thing is the heading, and that plus the contents below it are the section (making the # thing also the "section heading" since it's the heading of the section), but if you "add a heading", you can also say you're "adding a section" since creating a delimiter establishes a section. :)

@ada4a

ada4a commented Aug 9, 2025

Copy link
Copy Markdown
ContributorAuthor

I intentionally avoided saying that I "added a section" because the section itself was already painstakingly written by someone else (whom I'm thankful to) -- I just added a name to it:)

Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading
I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.
Do let me know whether you think this is the right approach.
@ZalatharZalathar mentioned this pull request Aug 10, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading
I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.
Do let me know whether you think this is the right approach.
@ZalatharZalathar mentioned this pull request Aug 10, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading
I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.
Do let me know whether you think this is the right approach.
@ZalatharZalathar mentioned this pull request Aug 10, 2025
bors added a commit that referenced this pull request Aug 10, 2025
Rollup of 19 pull requests
Successful merges:
- #141624 (unstable-book: Add stubs for environment variables; document some of the important ones)
- #143093 (Simplify polonius location-sensitive analysis)
- #144402 (Stabilize loongarch32 inline asm)
- #144403 (`tests/ui/issues/`: The Issues Strike Back [4/N])
- #144544 (Start reporting future breakage for `ILL_FORMED_ATTRIBUTE_INPUT` in dependencies)
- #144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc)
- #145089 (Improve error output when a command fails in bootstrap)
- #145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC)
- #145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC)
- #145130 (improve "Documentation problem" issue template.)
- #145135 (Stabilize `duration_constructors_lite` feature)
- #145145 (some `derive_more` refactors)
- #145147 (rename `TraitRef::from_method` to `from_assoc`)
- #145156 (Override custom Cargo `build-dir` in bootstrap)
- #145160 (Change days-threshold to 28 in [behind-upstream])
- #145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading)
- #145175 (Enable limit_rdylib_exports on Solaris)
- #145187 (Fix an unstable feature comment that wasn't a doc comment)
- #145191 (`suggest_borrow_generic_arg`: use the correct generic args)
r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 10, 2025
…-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading
I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.
Do let me know whether you think this is the right approach.
@ZalatharZalathar mentioned this pull request Aug 10, 2025
bors added a commit that referenced this pull request Aug 10, 2025
Rollup of 18 pull requests
Successful merges:
- #141624 (unstable-book: Add stubs for environment variables; document some of the important ones)
- #143093 (Simplify polonius location-sensitive analysis)
- #144402 (Stabilize loongarch32 inline asm)
- #144403 (`tests/ui/issues/`: The Issues Strike Back [4/N])
- #144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc)
- #145089 (Improve error output when a command fails in bootstrap)
- #145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC)
- #145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC)
- #145130 (improve "Documentation problem" issue template.)
- #145135 (Stabilize `duration_constructors_lite` feature)
- #145145 (some `derive_more` refactors)
- #145147 (rename `TraitRef::from_method` to `from_assoc`)
- #145156 (Override custom Cargo `build-dir` in bootstrap)
- #145160 (Change days-threshold to 28 in [behind-upstream])
- #145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading)
- #145175 (Enable limit_rdylib_exports on Solaris)
- #145187 (Fix an unstable feature comment that wasn't a doc comment)
- #145191 (`suggest_borrow_generic_arg`: use the correct generic args)
r? `@ghost`
`@rustbot` modify labels: rollup
@ZalatharZalathar mentioned this pull request Aug 10, 2025
bors added a commit that referenced this pull request Aug 10, 2025
Rollup of 17 pull requests
Successful merges:
- #141624 (unstable-book: Add stubs for environment variables; document some of the important ones)
- #143093 (Simplify polonius location-sensitive analysis)
- #144402 (Stabilize loongarch32 inline asm)
- #144403 (`tests/ui/issues/`: The Issues Strike Back [4/N])
- #144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc)
- #145089 (Improve error output when a command fails in bootstrap)
- #145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC)
- #145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC)
- #145130 (improve "Documentation problem" issue template.)
- #145135 (Stabilize `duration_constructors_lite` feature)
- #145145 (some `derive_more` refactors)
- #145147 (rename `TraitRef::from_method` to `from_assoc`)
- #145156 (Override custom Cargo `build-dir` in bootstrap)
- #145160 (Change days-threshold to 28 in [behind-upstream])
- #145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading)
- #145187 (Fix an unstable feature comment that wasn't a doc comment)
- #145191 (`suggest_borrow_generic_arg`: use the correct generic args)
r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 10, 2025
Rollup of 17 pull requests
Successful merges:
- #141624 (unstable-book: Add stubs for environment variables; document some of the important ones)
- #143093 (Simplify polonius location-sensitive analysis)
- #144402 (Stabilize loongarch32 inline asm)
- #144403 (`tests/ui/issues/`: The Issues Strike Back [4/N])
- #144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc)
- #145089 (Improve error output when a command fails in bootstrap)
- #145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC)
- #145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC)
- #145130 (improve "Documentation problem" issue template.)
- #145135 (Stabilize `duration_constructors_lite` feature)
- #145145 (some `derive_more` refactors)
- #145147 (rename `TraitRef::from_method` to `from_assoc`)
- #145156 (Override custom Cargo `build-dir` in bootstrap)
- #145160 (Change days-threshold to 28 in [behind-upstream])
- #145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading)
- #145187 (Fix an unstable feature comment that wasn't a doc comment)
- #145191 (`suggest_borrow_generic_arg`: use the correct generic args)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 461009d into rust-lang:masterAug 10, 2025
10 checks passed
@rustbotrustbot added this to the 1.91.0 milestone Aug 10, 2025
rust-timer added a commit that referenced this pull request Aug 10, 2025
Rollup merge of #145162 - ada4a:hash_and_btree_map-add-entry-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading
I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.
Do let me know whether you think this is the right approach.
github-actionsBot pushed a commit to model-checking/verify-rust-std that referenced this pull request Aug 13, 2025
…-section, r=joshtriplett
`{BTree,Hash}Map`: add "`Entry` API" section heading
I wanted to link to an introduction of the `Entry` API to the help message of `clippy::map_entry` (see rust-lang/rust-clippy#11598 for motivation), but I found the documentation on the `Entry` enum itself a bit short. On the other hand, `{BTree,Hash}Map` both have sections in their docs introducing the whole API and giving usage examples, and so I would like to link to that instead. For that, I introduce the "`Entry` API" section heading to both of them.
Do let me know whether you think this is the right approach.
@ada4a
ada4a deleted the hash_and_btree_map-add-entry-section branch August 24, 2025 07:55
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ada4a@rustbot@joshtriplett@bors@tgross35