`Vec::is_empty` is not marked as `#[inline]`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Similar methods in Vec are annotated with #[inline] including Vec::len but Vec::is_empty is not. Looking at the relevant policy it seems to me is_empty satisfies all the requirements to be inlined. Is this deliberate or it could be beneficial to add it?
To be more precise, I am referring to this function: https://doc.rust-lang.org/nightly/src/alloc/vec/mod.rs.html#3040.
Curiously, this other implementation of is_empty for slices is inline: https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#136
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 with Vec::is_empty in alloc/vec/mod.rs around the linked source location, then compare the inline annotation on slice is_empty in core/slice/mod.rs and read the linked inline policy. Confirm whether the function meets the policy and whether the change should add the annotation; done means the decision is reflected in the source and relevant checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100