Skip to content

Commit

Permalink
Use bool::then instead of if
Browse files Browse the repository at this point in the history
Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
  • Loading branch information
jhorstmann and tustvold committed Jun 13, 2022
1 parent d1c13e2 commit 7bfc3f6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions arrow/src/array/array_primitive.rs
Expand Up @@ -418,11 +418,7 @@ impl<'a, T: ArrowPrimitiveType, Ptr: Into<NativeAdapter<T>>> FromIterator<Ptr>
let null_buf: Buffer = null_builder.into();
let valid_count = null_buf.count_set_bits();
let null_count = len - valid_count;
let opt_null_buf = if null_count == 0 {
None
} else {
Some(null_buf)
};
let opt_null_buf = (null_count != 0).then(|| null_buf);

let data = unsafe {
ArrayData::new_unchecked(
Expand Down

0 comments on commit 7bfc3f6

Please sign in to comment.