From 2b06aa26102e3a87482f43dc1debe29f3ed45c30 Mon Sep 17 00:00:00 2001 From: sundyli <543950155@qq.com> Date: Mon, 28 Feb 2022 13:33:59 +0800 Subject: [PATCH] Apply comments --- Cargo.toml | 13 ++++++------- src/types/bit_chunk.rs | 9 +++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e02830dcb9e..d88a6c340f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -249,15 +249,14 @@ harness = false name = "comparison_kernels" harness = false -## disabled because we don't have the path of env `CARGO_MANIFEST_DIR` -# [[bench]] -# name = "read_parquet" -# harness = false +[[bench]] +name = "read_parquet" +harness = false -# [[bench]] -# name = "write_parquet" -# harness = false +[[bench]] +name = "write_parquet" +harness = false [[bench]] name = "aggregate" diff --git a/src/types/bit_chunk.rs b/src/types/bit_chunk.rs index d89be97a789..22f677aae4a 100644 --- a/src/types/bit_chunk.rs +++ b/src/types/bit_chunk.rs @@ -99,6 +99,10 @@ impl Iterator for BitChunkIter { } } +// # Safety +// a mathematical invariant of this iterator +unsafe impl crate::trusted_len::TrustedLen for BitChunkIter {} + /// An [`Iterator`] over a [`BitChunk`]. /// This iterator returns the postion of bit set. /// Refer: https://lemire.me/blog/2018/03/08/iterating-over-set-bits-quickly-simd-edition/ @@ -147,6 +151,10 @@ impl Iterator for BitChunkOnes { } } +// # Safety +// a mathematical invariant of this iterator +unsafe impl crate::trusted_len::TrustedLen for BitChunkOnes {} + #[cfg(test)] mod tests { use super::*; @@ -165,6 +173,7 @@ mod tests { let a = [0b00000001, 0b00010000]; // 0th and 13th entry let a = u16::from_ne_bytes(a); let mut iter = BitChunkOnes::new(a); + assert_eq!(iter.size_hint(), (2, Some(2))); assert_eq!(iter.next(), Some(0)); assert_eq!(iter.next(), Some(12)); }