From 20433530e7f60fa9ff45ae7c51c3e5ab27c7a2d0 Mon Sep 17 00:00:00 2001 From: June <61218022+itsjunetime@users.noreply.github.com> Date: Mon, 21 Oct 2024 07:08:21 -0600 Subject: [PATCH] Fix clippy complaints (#6573) * Fix clippy complaints * Switch back to casting metadata to *const u8 for c_char = i8 platforms --------- Co-authored-by: Andrew Lamb --- arrow-arith/src/aggregate.rs | 4 +- arrow-array/src/array/boolean_array.rs | 2 +- arrow-array/src/array/dictionary_array.rs | 10 ++--- .../src/array/fixed_size_list_array.rs | 20 +++++----- arrow-array/src/array/list_array.rs | 2 +- arrow-array/src/array/list_view_array.rs | 2 +- arrow-array/src/array/map_array.rs | 2 +- arrow-array/src/array/mod.rs | 2 +- arrow-array/src/array/primitive_array.rs | 3 +- arrow-array/src/array/run_array.rs | 17 ++++----- arrow-array/src/cast.rs | 1 - arrow-array/src/ffi.rs | 2 +- arrow-avro/src/schema.rs | 2 +- arrow-buffer/src/util/bit_iterator.rs | 10 ++--- arrow-buffer/src/util/bit_mask.rs | 2 +- arrow-buffer/src/util/bit_util.rs | 2 +- arrow-cast/src/cast/mod.rs | 2 +- arrow-cast/src/display.rs | 30 +++++++-------- arrow-data/src/transform/mod.rs | 4 +- arrow-flight/src/encode.rs | 6 +-- arrow-flight/src/sql/server.rs | 1 - arrow-ipc/src/convert.rs | 4 +- arrow-ipc/src/writer.rs | 1 - arrow-json/src/reader/serializer.rs | 10 ++--- arrow-json/src/reader/tape.rs | 4 +- arrow-json/src/writer/encoder.rs | 16 ++++---- arrow-ord/src/cmp.rs | 2 +- arrow-row/src/lib.rs | 16 ++++---- arrow-schema/src/datatype_parse.rs | 2 +- arrow-schema/src/ffi.rs | 5 +++ arrow-select/src/filter.rs | 4 +- parquet/src/arrow/async_reader/metadata.rs | 2 +- parquet/src/arrow/async_reader/mod.rs | 2 +- parquet/src/bloom_filter/mod.rs | 2 +- parquet/src/column/writer/mod.rs | 2 +- parquet/src/data_type.rs | 2 +- parquet/src/encodings/rle.rs | 38 +++++++++---------- parquet/src/file/serialized_reader.rs | 6 +-- parquet/src/file/writer.rs | 2 +- parquet/src/record/api.rs | 2 +- parquet/src/record/reader.rs | 4 +- parquet/src/schema/parser.rs | 2 +- parquet/src/schema/printer.rs | 2 +- parquet/src/schema/types.rs | 2 +- parquet/src/thrift.rs | 2 +- parquet/src/util/bit_util.rs | 2 +- parquet/tests/arrow_reader/statistics.rs | 4 +- 47 files changed, 131 insertions(+), 135 deletions(-) diff --git a/arrow-arith/src/aggregate.rs b/arrow-arith/src/aggregate.rs index a4915f5893df..ef0fddeb0b8e 100644 --- a/arrow-arith/src/aggregate.rs +++ b/arrow-arith/src/aggregate.rs @@ -194,14 +194,14 @@ fn aggregate_nullable_chunk, cons } fn aggregate_nonnull_simple>(values: &[T]) -> T { - return values + values .iter() .copied() .fold(A::default(), |mut a, b| { a.accumulate(b); a }) - .finish(); + .finish() } #[inline(never)] diff --git a/arrow-array/src/array/boolean_array.rs b/arrow-array/src/array/boolean_array.rs index 2bf8129fd007..fea8616c9168 100644 --- a/arrow-array/src/array/boolean_array.rs +++ b/arrow-array/src/array/boolean_array.rs @@ -329,7 +329,7 @@ impl Array for BooleanArray { } } -impl<'a> ArrayAccessor for &'a BooleanArray { +impl ArrayAccessor for &BooleanArray { type Item = bool; fn value(&self, index: usize) -> Self::Item { diff --git a/arrow-array/src/array/dictionary_array.rs b/arrow-array/src/array/dictionary_array.rs index bdb6f0d4b5c9..a3931d38d44a 100644 --- a/arrow-array/src/array/dictionary_array.rs +++ b/arrow-array/src/array/dictionary_array.rs @@ -799,15 +799,15 @@ pub struct TypedDictionaryArray<'a, K: ArrowDictionaryKeyType, V> { } // Manually implement `Clone` to avoid `V: Clone` type constraint -impl<'a, K: ArrowDictionaryKeyType, V> Clone for TypedDictionaryArray<'a, K, V> { +impl Clone for TypedDictionaryArray<'_, K, V> { fn clone(&self) -> Self { *self } } -impl<'a, K: ArrowDictionaryKeyType, V> Copy for TypedDictionaryArray<'a, K, V> {} +impl Copy for TypedDictionaryArray<'_, K, V> {} -impl<'a, K: ArrowDictionaryKeyType, V> std::fmt::Debug for TypedDictionaryArray<'a, K, V> { +impl std::fmt::Debug for TypedDictionaryArray<'_, K, V> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { writeln!(f, "TypedDictionaryArray({:?})", self.dictionary) } @@ -825,7 +825,7 @@ impl<'a, K: ArrowDictionaryKeyType, V> TypedDictionaryArray<'a, K, V> { } } -impl<'a, K: ArrowDictionaryKeyType, V: Sync> Array for TypedDictionaryArray<'a, K, V> { +impl Array for TypedDictionaryArray<'_, K, V> { fn as_any(&self) -> &dyn Any { self.dictionary } @@ -879,7 +879,7 @@ impl<'a, K: ArrowDictionaryKeyType, V: Sync> Array for TypedDictionaryArray<'a, } } -impl<'a, K, V> IntoIterator for TypedDictionaryArray<'a, K, V> +impl IntoIterator for TypedDictionaryArray<'_, K, V> where K: ArrowDictionaryKeyType, Self: ArrayAccessor, diff --git a/arrow-array/src/array/fixed_size_list_array.rs b/arrow-array/src/array/fixed_size_list_array.rs index 0d57d9a690aa..72855cef1f04 100644 --- a/arrow-array/src/array/fixed_size_list_array.rs +++ b/arrow-array/src/array/fixed_size_list_array.rs @@ -60,23 +60,23 @@ use std::sync::Arc; /// /// ```text /// ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ -/// ┌ ─ ─ ─ ─ ─ ─ ─ ─┐ +/// ┌ ─ ─ ─ ─ ─ ─ ─ ─┐ /// ┌─────────────┐ │ ┌───┐ ┌───┐ ┌──────┐ │ -/// │ [A,B] │ │ 1 │ │ │ 1 │ │ A │ │ 0 +/// │ [A,B] │ │ 1 │ │ │ 1 │ │ A │ │ 0 /// ├─────────────┤ │ ├───┤ ├───┤ ├──────┤ │ -/// │ NULL │ │ 0 │ │ │ 1 │ │ B │ │ 1 +/// │ NULL │ │ 0 │ │ │ 1 │ │ B │ │ 1 /// ├─────────────┤ │ ├───┤ ├───┤ ├──────┤ │ -/// │ [C,NULL] │ │ 1 │ │ │ 0 │ │ ???? │ │ 2 +/// │ [C,NULL] │ │ 1 │ │ │ 0 │ │ ???? │ │ 2 /// └─────────────┘ │ └───┘ ├───┤ ├──────┤ │ -/// | │ 0 │ │ ???? │ │ 3 +/// | │ 0 │ │ ???? │ │ 3 /// Logical Values │ Validity ├───┤ ├──────┤ │ -/// (nulls) │ │ 1 │ │ C │ │ 4 +/// (nulls) │ │ 1 │ │ C │ │ 4 /// │ ├───┤ ├──────┤ │ -/// │ │ 0 │ │ ???? │ │ 5 +/// │ │ 0 │ │ ???? │ │ 5 /// │ └───┘ └──────┘ │ -/// │ Values │ +/// │ Values │ /// │ FixedSizeListArray (Array) │ -/// └ ─ ─ ─ ─ ─ ─ ─ ─┘ +/// └ ─ ─ ─ ─ ─ ─ ─ ─┘ /// └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ /// ``` /// @@ -448,7 +448,7 @@ impl std::fmt::Debug for FixedSizeListArray { } } -impl<'a> ArrayAccessor for &'a FixedSizeListArray { +impl ArrayAccessor for &FixedSizeListArray { type Item = ArrayRef; fn value(&self, index: usize) -> Self::Item { diff --git a/arrow-array/src/array/list_array.rs b/arrow-array/src/array/list_array.rs index 13b446b0382d..06d5ee4e142d 100644 --- a/arrow-array/src/array/list_array.rs +++ b/arrow-array/src/array/list_array.rs @@ -512,7 +512,7 @@ impl Array for GenericListArray { } } -impl<'a, OffsetSize: OffsetSizeTrait> ArrayAccessor for &'a GenericListArray { +impl ArrayAccessor for &GenericListArray { type Item = ArrayRef; fn value(&self, index: usize) -> Self::Item { diff --git a/arrow-array/src/array/list_view_array.rs b/arrow-array/src/array/list_view_array.rs index 9b9078c23772..bab686c3e47a 100644 --- a/arrow-array/src/array/list_view_array.rs +++ b/arrow-array/src/array/list_view_array.rs @@ -285,7 +285,7 @@ impl GenericListViewArray { } } -impl<'a, OffsetSize: OffsetSizeTrait> ArrayAccessor for &'a GenericListViewArray { +impl ArrayAccessor for &GenericListViewArray { type Item = ArrayRef; fn value(&self, index: usize) -> Self::Item { diff --git a/arrow-array/src/array/map_array.rs b/arrow-array/src/array/map_array.rs index bddf202bdede..d40b8ee84518 100644 --- a/arrow-array/src/array/map_array.rs +++ b/arrow-array/src/array/map_array.rs @@ -399,7 +399,7 @@ impl Array for MapArray { } } -impl<'a> ArrayAccessor for &'a MapArray { +impl ArrayAccessor for &MapArray { type Item = StructArray; fn value(&self, index: usize) -> Self::Item { diff --git a/arrow-array/src/array/mod.rs b/arrow-array/src/array/mod.rs index 296f5ae721b3..f1ed1188268e 100644 --- a/arrow-array/src/array/mod.rs +++ b/arrow-array/src/array/mod.rs @@ -374,7 +374,7 @@ impl Array for ArrayRef { } } -impl<'a, T: Array> Array for &'a T { +impl Array for &T { fn as_any(&self) -> &dyn Any { T::as_any(self) } diff --git a/arrow-array/src/array/primitive_array.rs b/arrow-array/src/array/primitive_array.rs index 567fa00e7385..0c100e39afc8 100644 --- a/arrow-array/src/array/primitive_array.rs +++ b/arrow-array/src/array/primitive_array.rs @@ -880,7 +880,6 @@ impl PrimitiveArray { /// let c = a.unary_mut(|x| x * 2 + 1).unwrap(); /// assert_eq!(c, Int32Array::from(vec![Some(11), Some(15), None])); /// ``` - pub fn unary_mut(self, op: F) -> Result, PrimitiveArray> where F: Fn(T::Native) -> T::Native, @@ -1174,7 +1173,7 @@ impl Array for PrimitiveArray { } } -impl<'a, T: ArrowPrimitiveType> ArrayAccessor for &'a PrimitiveArray { +impl ArrayAccessor for &PrimitiveArray { type Item = T::Native; fn value(&self, index: usize) -> Self::Item { diff --git a/arrow-array/src/array/run_array.rs b/arrow-array/src/array/run_array.rs index aa8bb259a0eb..95291f8829b6 100644 --- a/arrow-array/src/array/run_array.rs +++ b/arrow-array/src/array/run_array.rs @@ -44,23 +44,22 @@ use crate::{ /// ```text /// ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┐ /// ┌─────────────────┐ ┌─────────┐ ┌─────────────────┐ -/// │ │ A │ │ 2 │ │ │ A │ +/// │ │ A │ │ 2 │ │ │ A │ /// ├─────────────────┤ ├─────────┤ ├─────────────────┤ /// │ │ D │ │ 3 │ │ │ A │ run length of 'A' = runs_ends[0] - 0 = 2 /// ├─────────────────┤ ├─────────┤ ├─────────────────┤ /// │ │ B │ │ 6 │ │ │ D │ run length of 'D' = run_ends[1] - run_ends[0] = 1 /// └─────────────────┘ └─────────┘ ├─────────────────┤ -/// │ values run_ends │ │ B │ +/// │ values run_ends │ │ B │ /// ├─────────────────┤ -/// └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┘ │ B │ +/// └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┘ │ B │ /// ├─────────────────┤ /// RunArray │ B │ run length of 'B' = run_ends[2] - run_ends[1] = 3 /// length = 3 └─────────────────┘ -/// +/// /// Logical array /// Contents /// ``` - pub struct RunArray { data_type: DataType, run_ends: RunEndBuffer, @@ -525,15 +524,15 @@ pub struct TypedRunArray<'a, R: RunEndIndexType, V> { } // Manually implement `Clone` to avoid `V: Clone` type constraint -impl<'a, R: RunEndIndexType, V> Clone for TypedRunArray<'a, R, V> { +impl Clone for TypedRunArray<'_, R, V> { fn clone(&self) -> Self { *self } } -impl<'a, R: RunEndIndexType, V> Copy for TypedRunArray<'a, R, V> {} +impl Copy for TypedRunArray<'_, R, V> {} -impl<'a, R: RunEndIndexType, V> std::fmt::Debug for TypedRunArray<'a, R, V> { +impl std::fmt::Debug for TypedRunArray<'_, R, V> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { writeln!(f, "TypedRunArray({:?})", self.run_array) } @@ -556,7 +555,7 @@ impl<'a, R: RunEndIndexType, V> TypedRunArray<'a, R, V> { } } -impl<'a, R: RunEndIndexType, V: Sync> Array for TypedRunArray<'a, R, V> { +impl Array for TypedRunArray<'_, R, V> { fn as_any(&self) -> &dyn Any { self.run_array } diff --git a/arrow-array/src/cast.rs b/arrow-array/src/cast.rs index cda179b78c2e..8c7cc2a12f62 100644 --- a/arrow-array/src/cast.rs +++ b/arrow-array/src/cast.rs @@ -408,7 +408,6 @@ macro_rules! downcast_primitive_array { /// .downcast_ref::() /// .unwrap(); /// ``` - pub fn as_primitive_array(arr: &dyn Array) -> &PrimitiveArray where T: ArrowPrimitiveType, diff --git a/arrow-array/src/ffi.rs b/arrow-array/src/ffi.rs index a28b3f746115..29414eae6fea 100644 --- a/arrow-array/src/ffi.rs +++ b/arrow-array/src/ffi.rs @@ -297,7 +297,7 @@ struct ImportedArrowArray<'a> { owner: &'a Arc, } -impl<'a> ImportedArrowArray<'a> { +impl ImportedArrowArray<'_> { fn consume(self) -> Result { let len = self.array.len(); let offset = self.array.offset(); diff --git a/arrow-avro/src/schema.rs b/arrow-avro/src/schema.rs index 6707f8137c9b..a9d91e47948b 100644 --- a/arrow-avro/src/schema.rs +++ b/arrow-avro/src/schema.rs @@ -64,7 +64,7 @@ pub struct Attributes<'a> { pub additional: HashMap<&'a str, serde_json::Value>, } -impl<'a> Attributes<'a> { +impl Attributes<'_> { /// Returns the field metadata for this [`Attributes`] pub(crate) fn field_metadata(&self) -> HashMap { self.additional diff --git a/arrow-buffer/src/util/bit_iterator.rs b/arrow-buffer/src/util/bit_iterator.rs index 2c4f246f2fa1..f667ab1e7b9d 100644 --- a/arrow-buffer/src/util/bit_iterator.rs +++ b/arrow-buffer/src/util/bit_iterator.rs @@ -53,7 +53,7 @@ impl<'a> BitIterator<'a> { } } -impl<'a> Iterator for BitIterator<'a> { +impl Iterator for BitIterator<'_> { type Item = bool; fn next(&mut self) -> Option { @@ -73,9 +73,9 @@ impl<'a> Iterator for BitIterator<'a> { } } -impl<'a> ExactSizeIterator for BitIterator<'a> {} +impl ExactSizeIterator for BitIterator<'_> {} -impl<'a> DoubleEndedIterator for BitIterator<'a> { +impl DoubleEndedIterator for BitIterator<'_> { fn next_back(&mut self) -> Option { if self.current_offset == self.end_offset { return None; @@ -138,7 +138,7 @@ impl<'a> BitSliceIterator<'a> { } } -impl<'a> Iterator for BitSliceIterator<'a> { +impl Iterator for BitSliceIterator<'_> { type Item = (usize, usize); fn next(&mut self) -> Option { @@ -211,7 +211,7 @@ impl<'a> BitIndexIterator<'a> { } } -impl<'a> Iterator for BitIndexIterator<'a> { +impl Iterator for BitIndexIterator<'_> { type Item = usize; fn next(&mut self) -> Option { diff --git a/arrow-buffer/src/util/bit_mask.rs b/arrow-buffer/src/util/bit_mask.rs index 83c395db8c03..97be7e006dec 100644 --- a/arrow-buffer/src/util/bit_mask.rs +++ b/arrow-buffer/src/util/bit_mask.rs @@ -275,7 +275,7 @@ mod tests { /// prints a byte slice as a binary string like "01010101 10101010" struct BinaryFormatter<'a>(&'a [u8]); - impl<'a> Display for BinaryFormatter<'a> { + impl Display for BinaryFormatter<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { for byte in self.0 { write!(f, "{:08b} ", byte)?; diff --git a/arrow-buffer/src/util/bit_util.rs b/arrow-buffer/src/util/bit_util.rs index bf14525bbd6b..ed5d363d607f 100644 --- a/arrow-buffer/src/util/bit_util.rs +++ b/arrow-buffer/src/util/bit_util.rs @@ -26,7 +26,7 @@ pub fn round_upto_multiple_of_64(num: usize) -> usize { /// Returns the nearest multiple of `factor` that is `>=` than `num`. Here `factor` must /// be a power of 2. pub fn round_upto_power_of_2(num: usize, factor: usize) -> usize { - debug_assert!(factor > 0 && (factor & (factor - 1)) == 0); + debug_assert!(factor > 0 && factor.is_power_of_two()); num.checked_add(factor - 1) .expect("failed to round to next highest power of 2") & !(factor - 1) diff --git a/arrow-cast/src/cast/mod.rs b/arrow-cast/src/cast/mod.rs index 7abadf5793b3..0497763cc772 100644 --- a/arrow-cast/src/cast/mod.rs +++ b/arrow-cast/src/cast/mod.rs @@ -77,7 +77,7 @@ pub struct CastOptions<'a> { pub format_options: FormatOptions<'a>, } -impl<'a> Default for CastOptions<'a> { +impl Default for CastOptions<'_> { fn default() -> Self { Self { safe: true, diff --git a/arrow-cast/src/display.rs b/arrow-cast/src/display.rs index df96816ea23a..669b8a664c2b 100644 --- a/arrow-cast/src/display.rs +++ b/arrow-cast/src/display.rs @@ -74,7 +74,7 @@ pub struct FormatOptions<'a> { duration_format: DurationFormat, } -impl<'a> Default for FormatOptions<'a> { +impl Default for FormatOptions<'_> { fn default() -> Self { Self::new() } @@ -166,7 +166,7 @@ pub struct ValueFormatter<'a> { formatter: &'a ArrayFormatter<'a>, } -impl<'a> ValueFormatter<'a> { +impl ValueFormatter<'_> { /// Writes this value to the provided [`Write`] /// /// Note: this ignores [`FormatOptions::with_display_error`] and @@ -187,7 +187,7 @@ impl<'a> ValueFormatter<'a> { } } -impl<'a> Display for ValueFormatter<'a> { +impl Display for ValueFormatter<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self.formatter.format.write(self.idx, f) { Ok(()) => Ok(()), @@ -395,7 +395,7 @@ impl<'a, F: DisplayIndexState<'a> + Array> DisplayIndex for ArrayFormat<'a, F> { } } -impl<'a> DisplayIndex for &'a BooleanArray { +impl DisplayIndex for &BooleanArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { write!(f, "{}", self.value(idx))?; Ok(()) @@ -450,7 +450,7 @@ primitive_display!(Int8Type, Int16Type, Int32Type, Int64Type); primitive_display!(UInt8Type, UInt16Type, UInt32Type, UInt64Type); primitive_display_float!(Float32Type, Float64Type); -impl<'a> DisplayIndex for &'a PrimitiveArray { +impl DisplayIndex for &PrimitiveArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { write!(f, "{}", self.value(idx))?; Ok(()) @@ -647,7 +647,7 @@ duration_display!(duration_ms_to_duration, DurationMillisecondType, 3); duration_display!(duration_us_to_duration, DurationMicrosecondType, 6); duration_display!(duration_ns_to_duration, DurationNanosecondType, 9); -impl<'a> DisplayIndex for &'a PrimitiveArray { +impl DisplayIndex for &PrimitiveArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { let interval = self.value(idx) as f64; let years = (interval / 12_f64).floor(); @@ -658,7 +658,7 @@ impl<'a> DisplayIndex for &'a PrimitiveArray { } } -impl<'a> DisplayIndex for &'a PrimitiveArray { +impl DisplayIndex for &PrimitiveArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { let value = self.value(idx); let mut prefix = ""; @@ -681,7 +681,7 @@ impl<'a> DisplayIndex for &'a PrimitiveArray { } } -impl<'a> DisplayIndex for &'a PrimitiveArray { +impl DisplayIndex for &PrimitiveArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { let value = self.value(idx); let mut prefix = ""; @@ -713,7 +713,7 @@ struct NanosecondsFormatter<'a> { prefix: &'a str, } -impl<'a> Display for NanosecondsFormatter<'a> { +impl Display for NanosecondsFormatter<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let mut prefix = self.prefix; @@ -756,7 +756,7 @@ struct MillisecondsFormatter<'a> { prefix: &'a str, } -impl<'a> Display for MillisecondsFormatter<'a> { +impl Display for MillisecondsFormatter<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let mut prefix = self.prefix; @@ -799,21 +799,21 @@ impl<'a> Display for MillisecondsFormatter<'a> { } } -impl<'a, O: OffsetSizeTrait> DisplayIndex for &'a GenericStringArray { +impl DisplayIndex for &GenericStringArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { write!(f, "{}", self.value(idx))?; Ok(()) } } -impl<'a> DisplayIndex for &'a StringViewArray { +impl DisplayIndex for &StringViewArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { write!(f, "{}", self.value(idx))?; Ok(()) } } -impl<'a, O: OffsetSizeTrait> DisplayIndex for &'a GenericBinaryArray { +impl DisplayIndex for &GenericBinaryArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { let v = self.value(idx); for byte in v { @@ -823,7 +823,7 @@ impl<'a, O: OffsetSizeTrait> DisplayIndex for &'a GenericBinaryArray { } } -impl<'a> DisplayIndex for &'a BinaryViewArray { +impl DisplayIndex for &BinaryViewArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { let v = self.value(idx); for byte in v { @@ -833,7 +833,7 @@ impl<'a> DisplayIndex for &'a BinaryViewArray { } } -impl<'a> DisplayIndex for &'a FixedSizeBinaryArray { +impl DisplayIndex for &FixedSizeBinaryArray { fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult { let v = self.value(idx); for byte in v { diff --git a/arrow-data/src/transform/mod.rs b/arrow-data/src/transform/mod.rs index c74b0c43481a..93b79e6a5eb8 100644 --- a/arrow-data/src/transform/mod.rs +++ b/arrow-data/src/transform/mod.rs @@ -64,7 +64,7 @@ struct _MutableArrayData<'a> { pub child_data: Vec>, } -impl<'a> _MutableArrayData<'a> { +impl _MutableArrayData<'_> { fn null_buffer(&mut self) -> &mut MutableBuffer { self.null_buffer .as_mut() @@ -177,7 +177,7 @@ pub struct MutableArrayData<'a> { extend_nulls: ExtendNulls, } -impl<'a> std::fmt::Debug for MutableArrayData<'a> { +impl std::fmt::Debug for MutableArrayData<'_> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { // ignores the closures. f.debug_struct("MutableArrayData") diff --git a/arrow-flight/src/encode.rs b/arrow-flight/src/encode.rs index 55bc9240321d..c05f5e81cef5 100644 --- a/arrow-flight/src/encode.rs +++ b/arrow-flight/src/encode.rs @@ -1597,11 +1597,7 @@ mod tests { while let Some(data) = stream.next().await.transpose().unwrap() { let actual_data_size = flight_data_size(&data); - let actual_overage = if actual_data_size > max_flight_data_size { - actual_data_size - max_flight_data_size - } else { - 0 - }; + let actual_overage = actual_data_size.saturating_sub(max_flight_data_size); assert!( actual_overage <= allowed_overage, diff --git a/arrow-flight/src/sql/server.rs b/arrow-flight/src/sql/server.rs index 37b2885b5aff..6b9befa63600 100644 --- a/arrow-flight/src/sql/server.rs +++ b/arrow-flight/src/sql/server.rs @@ -552,7 +552,6 @@ pub trait FlightSqlService: Sync + Send + Sized + 'static { } /// do_exchange - /// Implementors may override to handle additional calls to do_exchange() async fn do_exchange_fallback( &self, diff --git a/arrow-ipc/src/convert.rs b/arrow-ipc/src/convert.rs index eef236529e10..18f5193bf038 100644 --- a/arrow-ipc/src/convert.rs +++ b/arrow-ipc/src/convert.rs @@ -66,7 +66,7 @@ pub struct IpcSchemaEncoder<'a> { dictionary_tracker: Option<&'a mut DictionaryTracker>, } -impl<'a> Default for IpcSchemaEncoder<'a> { +impl Default for IpcSchemaEncoder<'_> { fn default() -> Self { Self::new() } @@ -162,7 +162,7 @@ pub fn schema_to_fb_offset<'a>( } /// Convert an IPC Field to Arrow Field -impl<'a> From> for Field { +impl From> for Field { fn from(field: crate::Field) -> Field { let arrow_field = if let Some(dictionary) = field.dictionary() { Field::new_dict( diff --git a/arrow-ipc/src/writer.rs b/arrow-ipc/src/writer.rs index f9256b4e8175..b5c4dd95ed9f 100644 --- a/arrow-ipc/src/writer.rs +++ b/arrow-ipc/src/writer.rs @@ -198,7 +198,6 @@ impl Default for IpcWriteOptions { /// ``` /// /// [Arrow IPC Format]: https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc - pub struct IpcDataGenerator {} impl IpcDataGenerator { diff --git a/arrow-json/src/reader/serializer.rs b/arrow-json/src/reader/serializer.rs index 2e1d76f98d05..95068af67833 100644 --- a/arrow-json/src/reader/serializer.rs +++ b/arrow-json/src/reader/serializer.rs @@ -305,7 +305,7 @@ impl<'a, 'b> ObjectSerializer<'a, 'b> { } } -impl<'a, 'b> SerializeMap for ObjectSerializer<'a, 'b> { +impl SerializeMap for ObjectSerializer<'_, '_> { type Ok = (); type Error = SerializerError; @@ -329,7 +329,7 @@ impl<'a, 'b> SerializeMap for ObjectSerializer<'a, 'b> { } } -impl<'a, 'b> SerializeStruct for ObjectSerializer<'a, 'b> { +impl SerializeStruct for ObjectSerializer<'_, '_> { type Ok = (); type Error = SerializerError; @@ -368,7 +368,7 @@ impl<'a, 'b> ListSerializer<'a, 'b> { } } -impl<'a, 'b> SerializeSeq for ListSerializer<'a, 'b> { +impl SerializeSeq for ListSerializer<'_, '_> { type Ok = (); type Error = SerializerError; @@ -385,7 +385,7 @@ impl<'a, 'b> SerializeSeq for ListSerializer<'a, 'b> { } } -impl<'a, 'b> SerializeTuple for ListSerializer<'a, 'b> { +impl SerializeTuple for ListSerializer<'_, '_> { type Ok = (); type Error = SerializerError; @@ -402,7 +402,7 @@ impl<'a, 'b> SerializeTuple for ListSerializer<'a, 'b> { } } -impl<'a, 'b> SerializeTupleStruct for ListSerializer<'a, 'b> { +impl SerializeTupleStruct for ListSerializer<'_, '_> { type Ok = (); type Error = SerializerError; diff --git a/arrow-json/src/reader/tape.rs b/arrow-json/src/reader/tape.rs index c783f6a51022..a93567f9fa18 100644 --- a/arrow-json/src/reader/tape.rs +++ b/arrow-json/src/reader/tape.rs @@ -648,7 +648,7 @@ impl<'a> BufIter<'a> { } } -impl<'a> Iterator for BufIter<'a> { +impl Iterator for BufIter<'_> { type Item = u8; fn next(&mut self) -> Option { @@ -660,7 +660,7 @@ impl<'a> Iterator for BufIter<'a> { } } -impl<'a> ExactSizeIterator for BufIter<'a> {} +impl ExactSizeIterator for BufIter<'_> {} /// Returns an error for a given byte `b` and context `ctx` fn err(b: u8, ctx: &str) -> ArrowError { diff --git a/arrow-json/src/writer/encoder.rs b/arrow-json/src/writer/encoder.rs index 29a302f74ce8..ae7d0d94e56b 100644 --- a/arrow-json/src/writer/encoder.rs +++ b/arrow-json/src/writer/encoder.rs @@ -179,7 +179,7 @@ fn is_some_and(opt: Option, f: impl FnOnce(T) -> bool) -> bool { } } -impl<'a> Encoder for StructArrayEncoder<'a> { +impl Encoder for StructArrayEncoder<'_> { fn encode(&mut self, idx: usize, out: &mut Vec) { out.push(b'{'); let mut is_first = true; @@ -294,7 +294,7 @@ impl Encoder for PrimitiveEncoder { struct BooleanEncoder<'a>(&'a BooleanArray); -impl<'a> Encoder for BooleanEncoder<'a> { +impl Encoder for BooleanEncoder<'_> { fn encode(&mut self, idx: usize, out: &mut Vec) { match self.0.value(idx) { true => out.extend_from_slice(b"true"), @@ -305,7 +305,7 @@ impl<'a> Encoder for BooleanEncoder<'a> { struct StringEncoder<'a, O: OffsetSizeTrait>(&'a GenericStringArray); -impl<'a, O: OffsetSizeTrait> Encoder for StringEncoder<'a, O> { +impl Encoder for StringEncoder<'_, O> { fn encode(&mut self, idx: usize, out: &mut Vec) { encode_string(self.0.value(idx), out); } @@ -331,7 +331,7 @@ impl<'a, O: OffsetSizeTrait> ListEncoder<'a, O> { } } -impl<'a, O: OffsetSizeTrait> Encoder for ListEncoder<'a, O> { +impl Encoder for ListEncoder<'_, O> { fn encode(&mut self, idx: usize, out: &mut Vec) { let end = self.offsets[idx + 1].as_usize(); let start = self.offsets[idx].as_usize(); @@ -377,7 +377,7 @@ impl<'a> FixedSizeListEncoder<'a> { } } -impl<'a> Encoder for FixedSizeListEncoder<'a> { +impl Encoder for FixedSizeListEncoder<'_> { fn encode(&mut self, idx: usize, out: &mut Vec) { let start = idx * self.value_length; let end = start + self.value_length; @@ -423,13 +423,13 @@ impl<'a, K: ArrowDictionaryKeyType> DictionaryEncoder<'a, K> { } } -impl<'a, K: ArrowDictionaryKeyType> Encoder for DictionaryEncoder<'a, K> { +impl Encoder for DictionaryEncoder<'_, K> { fn encode(&mut self, idx: usize, out: &mut Vec) { self.encoder.encode(self.keys[idx].as_usize(), out) } } -impl<'a> Encoder for ArrayFormatter<'a> { +impl Encoder for ArrayFormatter<'_> { fn encode(&mut self, idx: usize, out: &mut Vec) { out.push(b'"'); // Should be infallible @@ -502,7 +502,7 @@ impl<'a> MapEncoder<'a> { } } -impl<'a> Encoder for MapEncoder<'a> { +impl Encoder for MapEncoder<'_> { fn encode(&mut self, idx: usize, out: &mut Vec) { let end = self.offsets[idx + 1].as_usize(); let start = self.offsets[idx].as_usize(); diff --git a/arrow-ord/src/cmp.rs b/arrow-ord/src/cmp.rs index 9d7874c6444d..f571e26c444c 100644 --- a/arrow-ord/src/cmp.rs +++ b/arrow-ord/src/cmp.rs @@ -500,7 +500,7 @@ trait ArrayOrd { fn is_lt(l: Self::Item, r: Self::Item) -> bool; } -impl<'a> ArrayOrd for &'a BooleanArray { +impl ArrayOrd for &BooleanArray { type Item = bool; fn len(&self) -> usize { diff --git a/arrow-row/src/lib.rs b/arrow-row/src/lib.rs index d38ca1c68e31..5780bdbfefb9 100644 --- a/arrow-row/src/lib.rs +++ b/arrow-row/src/lib.rs @@ -1013,13 +1013,13 @@ impl<'a> Iterator for RowsIter<'a> { } } -impl<'a> ExactSizeIterator for RowsIter<'a> { +impl ExactSizeIterator for RowsIter<'_> { fn len(&self) -> usize { self.end - self.start } } -impl<'a> DoubleEndedIterator for RowsIter<'a> { +impl DoubleEndedIterator for RowsIter<'_> { fn next_back(&mut self) -> Option { if self.end == self.start { return None; @@ -1062,37 +1062,37 @@ impl<'a> Row<'a> { // Manually derive these as don't wish to include `fields` -impl<'a> PartialEq for Row<'a> { +impl PartialEq for Row<'_> { #[inline] fn eq(&self, other: &Self) -> bool { self.data.eq(other.data) } } -impl<'a> Eq for Row<'a> {} +impl Eq for Row<'_> {} -impl<'a> PartialOrd for Row<'a> { +impl PartialOrd for Row<'_> { #[inline] fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } -impl<'a> Ord for Row<'a> { +impl Ord for Row<'_> { #[inline] fn cmp(&self, other: &Self) -> Ordering { self.data.cmp(other.data) } } -impl<'a> Hash for Row<'a> { +impl Hash for Row<'_> { #[inline] fn hash(&self, state: &mut H) { self.data.hash(state) } } -impl<'a> AsRef<[u8]> for Row<'a> { +impl AsRef<[u8]> for Row<'_> { #[inline] fn as_ref(&self) -> &[u8] { self.data diff --git a/arrow-schema/src/datatype_parse.rs b/arrow-schema/src/datatype_parse.rs index 40d411ba27ca..4378950329f3 100644 --- a/arrow-schema/src/datatype_parse.rs +++ b/arrow-schema/src/datatype_parse.rs @@ -490,7 +490,7 @@ impl<'a> Tokenizer<'a> { } } -impl<'a> Iterator for Tokenizer<'a> { +impl Iterator for Tokenizer<'_> { type Item = ArrowResult; fn next(&mut self) -> Option { diff --git a/arrow-schema/src/ffi.rs b/arrow-schema/src/ffi.rs index e12c37da4898..70650d769cf6 100644 --- a/arrow-schema/src/ffi.rs +++ b/arrow-schema/src/ffi.rs @@ -336,6 +336,11 @@ impl FFI_ArrowSchema { Ok(HashMap::new()) } else { let mut pos = 0; + + // On some platforms, c_char = u8, and on some, c_char = i8. Where c_char = u8, clippy + // wants to complain that we're casting to the same type, but if we remove the cast, + // this will fail to compile on the other platforms. So we must allow it. + #[allow(clippy::unnecessary_cast)] let buffer: *const u8 = self.metadata as *const u8; fn next_four_bytes(buffer: *const u8, pos: &mut isize) -> [u8; 4] { diff --git a/arrow-select/src/filter.rs b/arrow-select/src/filter.rs index 8198980cb97a..d616b01e7750 100644 --- a/arrow-select/src/filter.rs +++ b/arrow-select/src/filter.rs @@ -62,7 +62,7 @@ impl<'a> SlicesIterator<'a> { } } -impl<'a> Iterator for SlicesIterator<'a> { +impl Iterator for SlicesIterator<'_> { type Item = (usize, usize); fn next(&mut self) -> Option { @@ -87,7 +87,7 @@ impl<'a> IndexIterator<'a> { } } -impl<'a> Iterator for IndexIterator<'a> { +impl Iterator for IndexIterator<'_> { type Item = usize; fn next(&mut self) -> Option { diff --git a/parquet/src/arrow/async_reader/metadata.rs b/parquet/src/arrow/async_reader/metadata.rs index afc77ae04fbd..b19f9830a7c9 100644 --- a/parquet/src/arrow/async_reader/metadata.rs +++ b/parquet/src/arrow/async_reader/metadata.rs @@ -69,7 +69,7 @@ pub trait MetadataFetch { fn fetch(&mut self, range: Range) -> BoxFuture<'_, Result>; } -impl<'a, T: AsyncFileReader> MetadataFetch for &'a mut T { +impl MetadataFetch for &mut T { fn fetch(&mut self, range: Range) -> BoxFuture<'_, Result> { self.get_bytes(range) } diff --git a/parquet/src/arrow/async_reader/mod.rs b/parquet/src/arrow/async_reader/mod.rs index 029567d4ef98..1c8b90b9b8fd 100644 --- a/parquet/src/arrow/async_reader/mod.rs +++ b/parquet/src/arrow/async_reader/mod.rs @@ -815,7 +815,7 @@ impl<'a> InMemoryRowGroup<'a> { } } -impl<'a> RowGroups for InMemoryRowGroup<'a> { +impl RowGroups for InMemoryRowGroup<'_> { fn num_rows(&self) -> usize { self.row_count } diff --git a/parquet/src/bloom_filter/mod.rs b/parquet/src/bloom_filter/mod.rs index f98111416f6a..7d6dccdd2378 100644 --- a/parquet/src/bloom_filter/mod.rs +++ b/parquet/src/bloom_filter/mod.rs @@ -415,7 +415,7 @@ mod tests { fn test_mask_set_quick_check() { for i in 0..1_000_000 { let result = Block::mask(i); - assert!(result.0.iter().all(|&x| x.count_ones() == 1)); + assert!(result.0.iter().all(|&x| x.is_power_of_two())); } } diff --git a/parquet/src/column/writer/mod.rs b/parquet/src/column/writer/mod.rs index 6071b68c62a5..9bd79840f760 100644 --- a/parquet/src/column/writer/mod.rs +++ b/parquet/src/column/writer/mod.rs @@ -79,7 +79,7 @@ pub enum ColumnWriter<'a> { FixedLenByteArrayColumnWriter(ColumnWriterImpl<'a, FixedLenByteArrayType>), } -impl<'a> ColumnWriter<'a> { +impl ColumnWriter<'_> { /// Returns the estimated total memory usage #[cfg(feature = "arrow")] pub(crate) fn memory_size(&self) -> usize { diff --git a/parquet/src/data_type.rs b/parquet/src/data_type.rs index a3d0e3ce78f7..c4c03727f44a 100644 --- a/parquet/src/data_type.rs +++ b/parquet/src/data_type.rs @@ -590,7 +590,7 @@ impl AsBytes for Vec { } } -impl<'a> AsBytes for &'a str { +impl AsBytes for &str { fn as_bytes(&self) -> &[u8] { (self as &str).as_bytes() } diff --git a/parquet/src/encodings/rle.rs b/parquet/src/encodings/rle.rs index e1ca8cd745e3..0c708c126503 100644 --- a/parquet/src/encodings/rle.rs +++ b/parquet/src/encodings/rle.rs @@ -15,6 +15,25 @@ // specific language governing permissions and limitations // under the License. +//! Rle/Bit-Packing Hybrid Encoding +//! The grammar for this encoding looks like the following (copied verbatim +//! from ): +//! +//! rle-bit-packed-hybrid: `` `` +//! length := length of the `` in bytes stored as 4 bytes little endian +//! encoded-data := ``* +//! run := `` | `` +//! bit-packed-run := `` `` +//! bit-packed-header := varint-encode(`` << 1 | 1) +//! we always bit-pack a multiple of 8 values at a time, so we only store the number of +//! values / 8 +//! bit-pack-count := (number of values in this run) / 8 +//! bit-packed-values := *see 1 below* +//! rle-run := `` `` +//! rle-header := varint-encode( (number of times repeated) << 1) +//! repeated-value := value that is repeated, using a fixed-width of +//! round-up-to-next-byte(bit-width) + use std::{cmp, mem::size_of}; use bytes::Bytes; @@ -22,25 +41,6 @@ use bytes::Bytes; use crate::errors::{ParquetError, Result}; use crate::util::bit_util::{self, BitReader, BitWriter, FromBytes}; -/// Rle/Bit-Packing Hybrid Encoding -/// The grammar for this encoding looks like the following (copied verbatim -/// from ): -/// -/// rle-bit-packed-hybrid: `` `` -/// length := length of the `` in bytes stored as 4 bytes little endian -/// encoded-data := ``* -/// run := `` | `` -/// bit-packed-run := `` `` -/// bit-packed-header := varint-encode(`` << 1 | 1) -/// we always bit-pack a multiple of 8 values at a time, so we only store the number of -/// values / 8 -/// bit-pack-count := (number of values in this run) / 8 -/// bit-packed-values := *see 1 below* -/// rle-run := `` `` -/// rle-header := varint-encode( (number of times repeated) << 1) -/// repeated-value := value that is repeated, using a fixed-width of -/// round-up-to-next-byte(bit-width) - /// Maximum groups of 8 values per bit-packed run. Current value is 64. const MAX_GROUPS_PER_BIT_PACKED_RUN: usize = 1 << 6; diff --git a/parquet/src/file/serialized_reader.rs b/parquet/src/file/serialized_reader.rs index 83cd61371d96..3262d1fba704 100644 --- a/parquet/src/file/serialized_reader.rs +++ b/parquet/src/file/serialized_reader.rs @@ -50,7 +50,7 @@ impl TryFrom for SerializedFileReader { } } -impl<'a> TryFrom<&'a Path> for SerializedFileReader { +impl TryFrom<&Path> for SerializedFileReader { type Error = ParquetError; fn try_from(path: &Path) -> Result { @@ -67,7 +67,7 @@ impl TryFrom for SerializedFileReader { } } -impl<'a> TryFrom<&'a str> for SerializedFileReader { +impl TryFrom<&str> for SerializedFileReader { type Error = ParquetError; fn try_from(path: &str) -> Result { @@ -302,7 +302,7 @@ impl<'a, R: ChunkReader> SerializedRowGroupReader<'a, R> { } } -impl<'a, R: 'static + ChunkReader> RowGroupReader for SerializedRowGroupReader<'a, R> { +impl RowGroupReader for SerializedRowGroupReader<'_, R> { fn metadata(&self) -> &RowGroupMetaData { self.metadata } diff --git a/parquet/src/file/writer.rs b/parquet/src/file/writer.rs index afbe1e549f56..95ff109a3dd0 100644 --- a/parquet/src/file/writer.rs +++ b/parquet/src/file/writer.rs @@ -715,7 +715,7 @@ impl<'a, W: Write> SerializedPageWriter<'a, W> { } } -impl<'a, W: Write + Send> PageWriter for SerializedPageWriter<'a, W> { +impl PageWriter for SerializedPageWriter<'_, W> { fn write_page(&mut self, page: CompressedPage) -> Result { let page_type = page.page_type(); let start_pos = self.sink.bytes_written() as u64; diff --git a/parquet/src/record/api.rs b/parquet/src/record/api.rs index 7a2e268b30f1..c95ce3f9223b 100644 --- a/parquet/src/record/api.rs +++ b/parquet/src/record/api.rs @@ -506,7 +506,7 @@ macro_rules! map_list_primitive_accessor { }; } -impl<'a> ListAccessor for MapList<'a> { +impl ListAccessor for MapList<'_> { map_list_primitive_accessor!(get_bool, Bool, bool); map_list_primitive_accessor!(get_byte, Byte, i8); diff --git a/parquet/src/record/reader.rs b/parquet/src/record/reader.rs index 57469ee9c372..1f9128a8b4f9 100644 --- a/parquet/src/record/reader.rs +++ b/parquet/src/record/reader.rs @@ -592,7 +592,7 @@ enum Either<'a> { Right(Box), } -impl<'a> Either<'a> { +impl Either<'_> { fn reader(&self) -> &dyn FileReader { match *self { Either::Left(r) => r, @@ -732,7 +732,7 @@ impl<'a> RowIter<'a> { } } -impl<'a> Iterator for RowIter<'a> { +impl Iterator for RowIter<'_> { type Item = Result; fn next(&mut self) -> Option> { diff --git a/parquet/src/schema/parser.rs b/parquet/src/schema/parser.rs index dcef11aa66d4..0a67250476c7 100644 --- a/parquet/src/schema/parser.rs +++ b/parquet/src/schema/parser.rs @@ -185,7 +185,7 @@ fn parse_timeunit( }) } -impl<'a> Parser<'a> { +impl Parser<'_> { // Entry function to parse message type, uses internal tokenizer. fn parse_message_type(&mut self) -> Result { // Check that message type starts with "message". diff --git a/parquet/src/schema/printer.rs b/parquet/src/schema/printer.rs index 32d727427ec1..4681c1a970b6 100644 --- a/parquet/src/schema/printer.rs +++ b/parquet/src/schema/printer.rs @@ -303,7 +303,7 @@ fn print_logical_and_converted( } #[allow(unused_must_use)] -impl<'a> Printer<'a> { +impl Printer<'_> { pub fn print(&mut self, tp: &Type) { self.print_indent(); match *tp { diff --git a/parquet/src/schema/types.rs b/parquet/src/schema/types.rs index 39d2fa28c627..dc67abe05b62 100644 --- a/parquet/src/schema/types.rs +++ b/parquet/src/schema/types.rs @@ -772,7 +772,7 @@ impl From> for ColumnPath { } } -impl<'a> From<&'a str> for ColumnPath { +impl From<&str> for ColumnPath { fn from(single_path: &str) -> Self { let s = String::from(single_path); ColumnPath::from(s) diff --git a/parquet/src/thrift.rs b/parquet/src/thrift.rs index 5be025f9540f..ceb6b1c29fe8 100644 --- a/parquet/src/thrift.rs +++ b/parquet/src/thrift.rs @@ -96,7 +96,7 @@ impl<'a> TCompactSliceInputProtocol<'a> { } } -impl<'a> TInputProtocol for TCompactSliceInputProtocol<'a> { +impl TInputProtocol for TCompactSliceInputProtocol<'_> { fn read_message_begin(&mut self) -> thrift::Result { unimplemented!() } diff --git a/parquet/src/util/bit_util.rs b/parquet/src/util/bit_util.rs index 062f93270386..b4c929ce0186 100644 --- a/parquet/src/util/bit_util.rs +++ b/parquet/src/util/bit_util.rs @@ -636,7 +636,7 @@ impl BitReader { /// `T` needs to be a little-endian native type. The value is assumed to be byte /// aligned so the bit reader will be advanced to the start of the next byte before /// reading the value. - + /// /// Returns `Some` if there's enough bytes left to form a value of `T`. /// Otherwise `None`. pub fn get_aligned(&mut self, num_bytes: usize) -> Option { diff --git a/parquet/tests/arrow_reader/statistics.rs b/parquet/tests/arrow_reader/statistics.rs index 29adbbb4f6fe..0eb0fc2b277f 100644 --- a/parquet/tests/arrow_reader/statistics.rs +++ b/parquet/tests/arrow_reader/statistics.rs @@ -218,7 +218,7 @@ struct Test<'a> { check: Check, } -impl<'a> Test<'a> { +impl Test<'_> { fn run(self) { let converter = StatisticsConverter::try_new( self.column_name, @@ -2553,7 +2553,7 @@ mod test { /// Formats the statistics nicely for display struct DisplayStats<'a>(&'a [RowGroupMetaData]); - impl<'a> std::fmt::Display for DisplayStats<'a> { + impl std::fmt::Display for DisplayStats<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let row_groups = self.0; writeln!(f, " row_groups: {}", row_groups.len())?;