Skip to content

Commit 0df837f

Browse files
committed
Add vec!['\0'; n] optimization, like vec![0; n]
Similarly to vec![ptr::null{,_mut}(); n] in previous change, this adds the optimization for vec!['\0'; n].
1 parent cc939ac commit 0df837f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/liballoc/vec.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,8 @@ impl_is_zero!(u64, |x| x == 0);
16111611
impl_is_zero!(u128, |x| x == 0);
16121612
impl_is_zero!(usize, |x| x == 0);
16131613

1614+
impl_is_zero!(char, |x| x == '\0');
1615+
16141616
impl_is_zero!(f32, |x: f32| x.to_bits() == 0);
16151617
impl_is_zero!(f64, |x: f64| x.to_bits() == 0);
16161618

0 commit comments

Comments
 (0)