tobixdev commented on code in PR #8543:
URL: https://github.com/apache/arrow-rs/pull/8543#discussion_r2407182879


##########
arrow-array/src/builder/boolean_builder.rs:
##########
@@ -234,9 +234,12 @@ impl ArrayBuilder for BooleanBuilder {
 impl Extend<Option<bool>> for BooleanBuilder {
     #[inline]
     fn extend<T: IntoIterator<Item = Option<bool>>>(&mut self, iter: T) {
-        for v in iter {
-            self.append_option(v)
-        }
+        let buffered = iter.into_iter().collect::<Vec<_>>();
+        let array = unsafe {
+            // SAFETY: buffered.into_iter() is a trusted length iterator

Review Comment:
   What about:
   `Vec::into_iter()` returns a trusted length iterator
   
   Otherwise, it could suggest that `Vec` directly implements `TrustedLen`. Or 
maybe that's the case and I don't fully understand `Vec`'s implementation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to