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

Commit 99c73dc

Browse files
committed
Apply clippy suggestions
1 parent 2a9b1a4 commit 99c73dc

File tree

21 files changed

+40
-48
lines changed

21 files changed

+40
-48
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ compute = [
301301
benchmarks = ["rand"]
302302
serde_types = ["serde", "serde_derive"]
303303
simd = []
304+
nightly_build = []
304305

305306
[build-dependencies]
306307
rustc_version = "0.4.0"

benches/bitmap_ops.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn add_benchmark(c: &mut Criterion) {
1111
(10..=20).step_by(2).for_each(|log2_size| {
1212
let size = 2usize.pow(log2_size);
1313

14-
let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
14+
let bitmap: Bitmap = (0..size).map(|x| x % 3 == 0).collect();
1515
c.bench_function(&format!("bitmap aligned not 2^{log2_size}"), |b| {
1616
b.iter(|| {
1717
let r = !&bitmap;
@@ -56,7 +56,7 @@ fn add_benchmark(c: &mut Criterion) {
5656
})
5757
});
5858

59-
let bitmap1: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect();
59+
let bitmap1: Bitmap = (0..size).map(|x| x % 4 == 0).collect();
6060
c.bench_function(&format!("bitmap aligned or 2^{log2_size}"), |b| {
6161
b.iter(|| bench_arrow2(&bitmap, &bitmap1))
6262
});

benches/slices_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn add_benchmark(c: &mut Criterion) {
1414
(10..=20).step_by(2).for_each(|log2_size| {
1515
let size = 2usize.pow(log2_size);
1616

17-
let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect();
17+
let bitmap: Bitmap = (0..size).map(|x| x % 3 == 0).collect();
1818
c.bench_function(&format!("bitmap slices 2^{log2_size}"), |b| {
1919
b.iter(|| bench_slices(&bitmap))
2020
});

src/array/binary/mutable.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,8 @@ impl<O: Offset, T: AsRef<[u8]>> TryPush<Option<T>> for MutableBinaryArray<O> {
441441
Some(value) => {
442442
self.values.try_push(value.as_ref())?;
443443

444-
match &mut self.validity {
445-
Some(validity) => validity.push(true),
446-
None => {}
444+
if let Some(validity) = &mut self.validity {
445+
validity.push(true)
447446
}
448447
}
449448
None => {

src/array/boolean/mutable.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ impl MutableBooleanArray {
108108
match value {
109109
Some(value) => {
110110
self.values.push(value);
111-
match &mut self.validity {
112-
Some(validity) => validity.push(true),
113-
None => {}
111+
if let Some(validity) = &mut self.validity {
112+
validity.push(true)
114113
}
115114
}
116115
None => {

src/array/dictionary/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<'a, K: DictionaryKey> DictionaryValuesIter<'a, K> {
2222
}
2323
}
2424

25-
impl<'a, K: DictionaryKey> Iterator for DictionaryValuesIter<'a, K> {
25+
impl<K: DictionaryKey> Iterator for DictionaryValuesIter<'_, K> {
2626
type Item = Box<dyn Scalar>;
2727

2828
#[inline]
@@ -41,9 +41,9 @@ impl<'a, K: DictionaryKey> Iterator for DictionaryValuesIter<'a, K> {
4141
}
4242
}
4343

44-
unsafe impl<'a, K: DictionaryKey> TrustedLen for DictionaryValuesIter<'a, K> {}
44+
unsafe impl<K: DictionaryKey> TrustedLen for DictionaryValuesIter<'_, K> {}
4545

46-
impl<'a, K: DictionaryKey> DoubleEndedIterator for DictionaryValuesIter<'a, K> {
46+
impl<K: DictionaryKey> DoubleEndedIterator for DictionaryValuesIter<'_, K> {
4747
#[inline]
4848
fn next_back(&mut self) -> Option<Self::Item> {
4949
if self.index == self.end {

src/array/dictionary/typed_iterator.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ impl<O: Offset> DictValue for Utf8Array<O> {
3737
.ok_or(Error::InvalidArgumentError(
3838
"could not convert array to dictionary value".into(),
3939
))
40-
.map(|arr| {
40+
.inspect(|arr| {
4141
assert_eq!(
4242
arr.null_count(),
4343
0,
4444
"null values in values not supported in iteration"
4545
);
46-
arr
4746
})
4847
}
4948
}
@@ -90,11 +89,9 @@ impl<'a, K: DictionaryKey, V: DictValue> Iterator for DictionaryValuesIterTyped<
9089
}
9190
}
9291

93-
unsafe impl<'a, K: DictionaryKey, V: DictValue> TrustedLen for DictionaryValuesIterTyped<'a, K, V> {}
92+
unsafe impl<K: DictionaryKey, V: DictValue> TrustedLen for DictionaryValuesIterTyped<'_, K, V> {}
9493

95-
impl<'a, K: DictionaryKey, V: DictValue> DoubleEndedIterator
96-
for DictionaryValuesIterTyped<'a, K, V>
97-
{
94+
impl<K: DictionaryKey, V: DictValue> DoubleEndedIterator for DictionaryValuesIterTyped<'_, K, V> {
9895
#[inline]
9996
fn next_back(&mut self) -> Option<Self::Item> {
10097
if self.index == self.end {

src/array/fixed_size_binary/mutable.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,8 @@ impl MutableFixedSizeBinaryArray {
119119
}
120120
self.values.extend_from_slice(bytes);
121121

122-
match &mut self.validity {
123-
Some(validity) => validity.push(true),
124-
None => {}
122+
if let Some(validity) = &mut self.validity {
123+
validity.push(true)
125124
}
126125
}
127126
None => {

src/array/growable/null.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl GrowableNull {
2929
}
3030
}
3131

32-
impl<'a> Growable<'a> for GrowableNull {
32+
impl Growable<'_> for GrowableNull {
3333
fn extend(&mut self, _: usize, _: usize, len: usize) {
3434
self.length += len;
3535
}

src/array/map/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'a> MapValuesIter<'a> {
2323
}
2424
}
2525

26-
impl<'a> Iterator for MapValuesIter<'a> {
26+
impl Iterator for MapValuesIter<'_> {
2727
type Item = Box<dyn Array>;
2828

2929
#[inline]
@@ -44,9 +44,9 @@ impl<'a> Iterator for MapValuesIter<'a> {
4444
}
4545
}
4646

47-
unsafe impl<'a> TrustedLen for MapValuesIter<'a> {}
47+
unsafe impl TrustedLen for MapValuesIter<'_> {}
4848

49-
impl<'a> DoubleEndedIterator for MapValuesIter<'a> {
49+
impl DoubleEndedIterator for MapValuesIter<'_> {
5050
#[inline]
5151
fn next_back(&mut self) -> Option<Self::Item> {
5252
if self.index == self.end {

src/array/primitive/mutable.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ impl<T: NativeType> MutablePrimitiveArray<T> {
137137
match value {
138138
Some(value) => {
139139
self.values.push(value);
140-
match &mut self.validity {
141-
Some(validity) => validity.push(true),
142-
None => {}
140+
if let Some(validity) = &mut self.validity {
141+
validity.push(true)
143142
}
144143
}
145144
None => {

src/array/struct_/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'a> StructValueIter<'a> {
2323
}
2424
}
2525

26-
impl<'a> Iterator for StructValueIter<'a> {
26+
impl Iterator for StructValueIter<'_> {
2727
type Item = Vec<Box<dyn Scalar>>;
2828

2929
#[inline]
@@ -51,9 +51,9 @@ impl<'a> Iterator for StructValueIter<'a> {
5151
}
5252
}
5353

54-
unsafe impl<'a> TrustedLen for StructValueIter<'a> {}
54+
unsafe impl TrustedLen for StructValueIter<'_> {}
5555

56-
impl<'a> DoubleEndedIterator for StructValueIter<'a> {
56+
impl DoubleEndedIterator for StructValueIter<'_> {
5757
#[inline]
5858
fn next_back(&mut self) -> Option<Self::Item> {
5959
if self.index == self.end {

src/array/union/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<'a> UnionIter<'a> {
1414
}
1515
}
1616

17-
impl<'a> Iterator for UnionIter<'a> {
17+
impl Iterator for UnionIter<'_> {
1818
type Item = Box<dyn Scalar>;
1919

2020
#[inline]
@@ -53,6 +53,6 @@ impl<'a> UnionArray {
5353
}
5454
}
5555

56-
impl<'a> std::iter::ExactSizeIterator for UnionIter<'a> {}
56+
impl std::iter::ExactSizeIterator for UnionIter<'_> {}
5757

58-
unsafe impl<'a> TrustedLen for UnionIter<'a> {}
58+
unsafe impl TrustedLen for UnionIter<'_> {}

src/array/utf8/mutable.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,8 @@ impl<O: Offset, T: AsRef<str>> TryPush<Option<T>> for MutableUtf8Array<O> {
521521
Some(value) => {
522522
self.values.try_push(value.as_ref())?;
523523

524-
match &mut self.validity {
525-
Some(validity) => validity.push(true),
526-
None => {}
524+
if let Some(validity) = &mut self.validity {
525+
validity.push(true)
527526
}
528527
}
529528
None => {

src/bitmap/bitmap_ops.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -238,23 +238,23 @@ impl PartialEq for Bitmap {
238238
}
239239
}
240240

241-
impl<'a, 'b> BitOr<&'b Bitmap> for &'a Bitmap {
241+
impl<'b> BitOr<&'b Bitmap> for &Bitmap {
242242
type Output = Bitmap;
243243

244244
fn bitor(self, rhs: &'b Bitmap) -> Bitmap {
245245
or(self, rhs)
246246
}
247247
}
248248

249-
impl<'a, 'b> BitAnd<&'b Bitmap> for &'a Bitmap {
249+
impl<'b> BitAnd<&'b Bitmap> for &Bitmap {
250250
type Output = Bitmap;
251251

252252
fn bitand(self, rhs: &'b Bitmap) -> Bitmap {
253253
and(self, rhs)
254254
}
255255
}
256256

257-
impl<'a, 'b> BitXor<&'b Bitmap> for &'a Bitmap {
257+
impl<'b> BitXor<&'b Bitmap> for &Bitmap {
258258
type Output = Bitmap;
259259

260260
fn bitxor(self, rhs: &'b Bitmap) -> Bitmap {

src/bitmap/utils/iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'a> BitmapIter<'a> {
3333
}
3434
}
3535

36-
impl<'a> Iterator for BitmapIter<'a> {
36+
impl Iterator for BitmapIter<'_> {
3737
type Item = bool;
3838

3939
#[inline]
@@ -66,7 +66,7 @@ impl<'a> Iterator for BitmapIter<'a> {
6666
}
6767
}
6868

69-
impl<'a> DoubleEndedIterator for BitmapIter<'a> {
69+
impl DoubleEndedIterator for BitmapIter<'_> {
7070
#[inline]
7171
fn next_back(&mut self) -> Option<bool> {
7272
if self.index == self.end {

src/bitmap/utils/slice_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a> SlicesIterator<'a> {
7373
}
7474
}
7575

76-
impl<'a> Iterator for SlicesIterator<'a> {
76+
impl Iterator for SlicesIterator<'_> {
7777
type Item = (usize, usize);
7878

7979
#[inline]

src/ffi/array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ pub struct ArrowArrayChild<'a> {
542542
parent: InternalArrowArray,
543543
}
544544

545-
impl<'a> ArrowArrayRef for ArrowArrayChild<'a> {
545+
impl ArrowArrayRef for ArrowArrayChild<'_> {
546546
/// the data_type as declared in the schema
547547
fn data_type(&self) -> &DataType {
548548
&self.data_type

src/scalar/fixed_size_list.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ impl FixedSizeListScalar {
3131
pub fn new(data_type: DataType, values: Option<Box<dyn Array>>) -> Self {
3232
let (field, size) = FixedSizeListArray::get_child_and_size(&data_type);
3333
let inner_data_type = field.data_type();
34-
let values = values.map(|x| {
34+
let values = values.inspect(|x| {
3535
assert_eq!(inner_data_type, x.data_type());
3636
assert_eq!(size, x.len());
37-
x
3837
});
3938
Self { values, data_type }
4039
}

tests/it/array/binary/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn from_iter() {
3535

3636
#[test]
3737
fn from_trusted_len_iter() {
38-
let data = vec![vec![0; 0], vec![1; 1], vec![2; 2]];
38+
let data = [vec![0; 0], vec![1; 1], vec![2; 2]];
3939
let a: MutableBinaryArray<i32> = data.iter().cloned().map(Some).collect();
4040
assert_eq!(a.values().deref(), &[1u8, 2, 2]);
4141
assert_eq!(a.offsets().as_slice(), &[0, 0, 1, 3]);

tests/it/bitmap/utils/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use re_arrow2::bitmap::utils::fmt;
22

33
struct A<'a>(&'a [u8], usize, usize);
44

5-
impl<'a> std::fmt::Debug for A<'a> {
5+
impl std::fmt::Debug for A<'_> {
66
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77
fmt(self.0, self.1, self.2, f)
88
}

0 commit comments

Comments
 (0)