[rustdoc] IndexItem initialization logic is duplicated
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
both add_item_to_search_index in formats/cache.rs and build_index in html/render/search_index.rs construct this type. Both functions have a decent bit of logic that is unique to them, but they also have a fair bit of logic that is the same for both.
I think moving this shared logic into an associated function on IndexItem would make the code easier to maintain.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing add_item_to_search_index in formats/cache.rs with build_index in html/render/search_index.rs, then inspect IndexItem to identify the duplicated initialization logic. Done means the shared logic is provided by an associated function on IndexItem, while each caller retains its unique behavior and rustdoc search-index behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100