Skip to content

Vec::is_empty is not marked as #[inline] #153963

@EnricoGhiorzi

Description

@EnricoGhiorzi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections`C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions