Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: servo/rust-smallvec
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.15.0
Choose a base ref
...
head repository: servo/rust-smallvec
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.15.1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Jun 6, 2025

  1. Shrink code produced by smallvec![].

    Currently `smallvec![]` expands to this:
    ```
    {
        let count = 0usize;
        #[allow(unused_mut)]
        let mut vec = ::smallvec::SmallVec::new();
        if count <= vec.capacity() {
            vec
        } else {
            ::smallvec::SmallVec::from_vec(::alloc::vec::Vec::new())
        }
    };
    ```
    This commit adds a rule to the `smallvec!` macro for the zero-length
    case so it instead expands to this:
    ```
    ::smallvec::SmallVec::new()
    ```
    The `std::vec!` macro already has a similar special case.
    
    This commit also improves the non-zero case.
    - It removes the `#[allow(unused_mut)]`, which was only needed for the
      zero-length case.
    - It changes the `*` repetitions to `+`. (Again, like `std::vec`.)
    nnethercote authored and mbrubeck committed Jun 6, 2025
    Configuration menu
    Copy the full SHA
    d682405 View commit details
    Browse the repository at this point in the history
  2. Version 1.15.1

    mbrubeck committed Jun 6, 2025
    Configuration menu
    Copy the full SHA
    d0f47a3 View commit details
    Browse the repository at this point in the history
Loading