1
Fork 0

Rollup merge of #58628 - RReverser:optimise-vec-false, r=oli-obk

Optimise vec![false; N] to zero-alloc

Nowadays booleans have a well-defined representation, so there is no reason not to optimise their allocation.
This commit is contained in:
Mazdak Farrokhzad 2019-02-23 09:25:32 +01:00 committed by GitHub
commit 93bfa92a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1610,6 +1610,7 @@ impl_is_zero!(u64, |x| x == 0);
impl_is_zero!(u128, |x| x == 0);
impl_is_zero!(usize, |x| x == 0);
impl_is_zero!(bool, |x| x == false);
impl_is_zero!(char, |x| x == '\0');
impl_is_zero!(f32, |x: f32| x.to_bits() == 0);