Skip to content

Commit 9f58c5f

Browse files
committed
Optimise vec![false; N] to zero-alloc
Nowadays booleans have a well-defined representation, so there is no reason not to optimise their allocation.
1 parent 1349c84 commit 9f58c5f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/liballoc/vec.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,7 @@ impl_is_zero!(u64, |x| x == 0);
16061606
impl_is_zero!(u128, |x| x == 0);
16071607
impl_is_zero!(usize, |x| x == 0);
16081608

1609+
impl_is_zero!(bool, |x| x == false);
16091610
impl_is_zero!(char, |x| x == '\0');
16101611

16111612
impl_is_zero!(f32, |x: f32| x.to_bits() == 0);

0 commit comments

Comments
 (0)