From 9f58c5fa7cf434dc6b19a961c4ec5a453e6dedcd Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Thu, 21 Feb 2019 23:02:34 +0000 Subject: [PATCH] Optimise vec![false; N] to zero-alloc Nowadays booleans have a well-defined representation, so there is no reason not to optimise their allocation. --- src/liballoc/vec.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index a351d482fedde..44042562a8122 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1606,6 +1606,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);