You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.)
0 commit comments