Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit ae59d05

Browse files
committed
Additional clippy warnings
1 parent 99c73dc commit ae59d05

File tree

21 files changed

+28
-21
lines changed

21 files changed

+28
-21
lines changed

src/array/binary/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<O: Offset> BinaryArray<O> {
8585

8686
if validity
8787
.as_ref()
88-
.map_or(false, |validity| validity.len() != offsets.len_proxy())
88+
.is_some_and(|validity| validity.len() != offsets.len_proxy())
8989
{
9090
return Err(Error::oos(
9191
"validity mask length must match the number of values",

src/array/binary/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<O: Offset> MutableBinaryArray<O> {
6969

7070
if validity
7171
.as_ref()
72-
.map_or(false, |validity| validity.len() != values.len())
72+
.is_some_and(|validity| validity.len() != values.len())
7373
{
7474
return Err(Error::oos(
7575
"validity's length must be equal to the number of values",

src/array/boolean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl BooleanArray {
6666
) -> Result<Self, Error> {
6767
if validity
6868
.as_ref()
69-
.map_or(false, |validity| validity.len() != values.len())
69+
.is_some_and(|validity| validity.len() != values.len())
7070
{
7171
return Err(Error::oos(
7272
"validity mask length must match the number of values",

src/array/boolean/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl MutableBooleanArray {
6666
) -> Result<Self, Error> {
6767
if validity
6868
.as_ref()
69-
.map_or(false, |validity| validity.len() != values.len())
69+
.is_some_and(|validity| validity.len() != values.len())
7070
{
7171
return Err(Error::oos(
7272
"validity mask length must match the number of values",

src/array/fixed_size_binary/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl FixedSizeBinaryArray {
4646

4747
if validity
4848
.as_ref()
49-
.map_or(false, |validity| validity.len() != len)
49+
.is_some_and(|validity| validity.len() != len)
5050
{
5151
return Err(Error::oos(
5252
"validity mask length must be equal to the number of values divided by size",
@@ -267,7 +267,10 @@ impl FixedSizeBinaryArray {
267267
}
268268

269269
pub trait FixedSizeBinaryValues {
270+
#[allow(dead_code)]
270271
fn values(&self) -> &[u8];
272+
273+
#[allow(dead_code)]
271274
fn size(&self) -> usize;
272275
}
273276

src/array/fixed_size_binary/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl MutableFixedSizeBinaryArray {
5757

5858
if validity
5959
.as_ref()
60-
.map_or(false, |validity| validity.len() != len)
60+
.is_some_and(|validity| validity.len() != len)
6161
{
6262
return Err(Error::oos(
6363
"validity mask length must be equal to the number of values divided by size",

src/array/fixed_size_list/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl FixedSizeListArray {
6161

6262
if validity
6363
.as_ref()
64-
.map_or(false, |validity| validity.len() != len)
64+
.is_some_and(|validity| validity.len() != len)
6565
{
6666
return Err(Error::oos(
6767
"validity mask length must be equal to the number of values divided by size",

src/array/list/iterator.rs

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ impl<'a, O: Offset> ListArray<O> {
4444
}
4545
}
4646

47+
#[allow(dead_code)]
4748
struct Iter<T, I: Iterator<Item = Option<T>>> {
4849
current: i32,
4950
offsets: std::vec::IntoIter<i32>,

src/array/list/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<O: Offset> ListArray<O> {
4848

4949
if validity
5050
.as_ref()
51-
.map_or(false, |validity| validity.len() != offsets.len_proxy())
51+
.is_some_and(|validity| validity.len() != offsets.len_proxy())
5252
{
5353
return Err(Error::oos(
5454
"validity mask length must match the number of values",

src/array/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl MapArray {
6060

6161
if validity
6262
.as_ref()
63-
.map_or(false, |validity| validity.len() != offsets.len_proxy())
63+
.is_some_and(|validity| validity.len() != offsets.len_proxy())
6464
{
6565
return Err(Error::oos(
6666
"validity mask length must match the number of values",

src/array/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//! * [`BinaryArray`] and [`MutableBinaryArray`], an array of opaque variable length values
1111
//! * [`ListArray`] and [`MutableListArray`], an array of arrays (e.g. `[[1, 2], None, [], [None]]`)
1212
//! * [`StructArray`] and [`MutableStructArray`], an array of arrays identified by a string (e.g. `{"a": [1, 2], "b": [true, false]}`)
13+
//!
1314
//! All immutable arrays implement the trait object [`Array`] and that can be downcasted
1415
//! to a concrete struct based on [`PhysicalType`](crate::datatypes::PhysicalType) available from [`Array::data_type`].
1516
//! All immutable arrays are backed by [`Buffer`](crate::buffer::Buffer) and thus cloning and slicing them is `O(1)`.
@@ -148,6 +149,7 @@ dyn_clone::clone_trait_object!(Array);
148149

149150
/// A trait describing an array with a backing store that can be preallocated to
150151
/// a given size.
152+
#[allow(dead_code)]
151153
pub(crate) trait Container {
152154
/// Create this array with a given capacity.
153155
fn with_capacity(capacity: usize) -> Self

src/array/primitive/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(super) fn check<T: NativeType>(
5959
values: &[T],
6060
validity_len: Option<usize>,
6161
) -> Result<(), Error> {
62-
if validity_len.map_or(false, |len| len != values.len()) {
62+
if validity_len.is_some_and(|len| len != values.len()) {
6363
return Err(Error::oos(
6464
"validity mask length must match the number of values",
6565
));

src/array/struct_/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl StructArray {
9797

9898
if validity
9999
.as_ref()
100-
.map_or(false, |validity| validity.len() != len)
100+
.is_some_and(|validity| validity.len() != len)
101101
{
102102
return Err(Error::oos(
103103
"The validity length of a StructArray must match its number of elements",

src/array/struct_/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn check(
6363
}
6464
})?;
6565

66-
if validity.map_or(false, |validity| validity != len) {
66+
if validity.is_some_and(|validity| validity != len) {
6767
return Err(Error::oos(
6868
"The validity length of a StructArray must match its number of elements",
6969
));

src/array/utf8/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<O: Offset> Utf8Array<O> {
9797
try_check_utf8(&offsets, &values)?;
9898
if validity
9999
.as_ref()
100-
.map_or(false, |validity| validity.len() != offsets.len_proxy())
100+
.is_some_and(|validity| validity.len() != offsets.len_proxy())
101101
{
102102
return Err(Error::oos(
103103
"validity mask length must match the number of values",
@@ -379,7 +379,7 @@ impl<O: Offset> Utf8Array<O> {
379379

380380
if validity
381381
.as_ref()
382-
.map_or(false, |validity| validity.len() != offsets.len_proxy())
382+
.is_some_and(|validity| validity.len() != offsets.len_proxy())
383383
{
384384
return Err(Error::oos(
385385
"validity mask length must match the number of values",

src/array/utf8/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<O: Offset> MutableUtf8Array<O> {
6969

7070
if validity
7171
.as_ref()
72-
.map_or(false, |validity| validity.len() != values.len())
72+
.is_some_and(|validity| validity.len() != values.len())
7373
{
7474
return Err(Error::oos(
7575
"validity's length must be equal to the number of values",

src/bitmap/utils/zip_validity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ where
9191
/// This enum can be used in two distinct ways:
9292
/// * as an iterator, via `Iterator::next`
9393
/// * as an enum of two iterators, via `match self`
94-
/// The latter allows specializalizing to when there are no nulls
94+
/// The latter allows specializalizing to when there are no nulls
9595
#[derive(Debug, Clone)]
9696
pub enum ZipValidity<T, I, V>
9797
where

src/buffer/immutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{iter::FromIterator, ops::Deref, sync::Arc, usize};
1+
use std::{iter::FromIterator, ops::Deref, sync::Arc};
22

33
use either::Either;
44

src/datatypes/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ pub enum DataType {
109109
/// * As used in the Olson time zone database (the "tz database" or
110110
/// "tzdata"), such as "America/New_York"
111111
/// * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30
112-
/// When the timezone is not specified, the timestamp is considered to have no timezone
113-
/// and is represented _as is_
112+
/// When the timezone is not specified, the timestamp is considered to have no timezone
113+
/// and is represented _as is_
114114
Timestamp(TimeUnit, Option<Arc<String>>),
115115
/// An [`i32`] representing the elapsed time since UNIX epoch (1970-01-01)
116116
/// in days.

src/ffi/array.rs

+1
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ pub trait ArrowArrayRef: std::fmt::Debug {
473473
create_dictionary(self.array(), self.data_type(), self.parent().clone())
474474
}
475475

476+
#[allow(dead_code)]
476477
fn n_buffers(&self) -> usize;
477478

478479
fn parent(&self) -> &InternalArrowArray;

src/temporal_conversions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,9 @@ fn chrono_tz_utf_to_timestamp_ns<O: Offset>(
447447
/// * parsed values with timezone other than `timezone` are converted to `timezone`.
448448
/// * parsed values without timezone are null. Use [`utf8_to_naive_timestamp_ns`] to parse naive timezones.
449449
/// * Null elements remain null; non-parsable elements are null.
450-
/// The feature `"chrono-tz"` enables IANA and zoneinfo formats for `timezone`.
450+
/// The feature `"chrono-tz"` enables IANA and zoneinfo formats for `timezone`.
451451
/// # Error
452-
/// This function errors iff `timezone` is not parsable to an offset.
452+
/// This function errors iff `timezone` is not parsable to an offset.
453453
pub fn utf8_to_timestamp_ns<O: Offset>(
454454
array: &Utf8Array<O>,
455455
fmt: &str,

0 commit comments

Comments
 (0)