Skip to content

Commit

Permalink
Update to latest Clippy (#3832)
Browse files Browse the repository at this point in the history
* Renamed clippy lint

* More clippy

* Even more clippy

* Clippy
  • Loading branch information
tustvold committed Mar 9, 2023
1 parent fb35d26 commit de9f826
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 17 deletions.
14 changes: 6 additions & 8 deletions arrow-arith/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2571,9 +2571,9 @@ mod tests {

#[test]
fn test_primitive_array_negate() {
let a: Int64Array = (0..100).into_iter().map(Some).collect();
let a: Int64Array = (0..100).map(Some).collect();
let actual = negate(&a).unwrap();
let expected: Int64Array = (0..100).into_iter().map(|i| Some(-i)).collect();
let expected: Int64Array = (0..100).map(|i| Some(-i)).collect();
assert_eq!(expected, actual);
}

Expand All @@ -2590,20 +2590,18 @@ mod tests {

#[test]
fn test_arithmetic_kernel_should_not_rely_on_padding() {
let a: UInt8Array = (0..128_u8).into_iter().map(Some).collect();
let a: UInt8Array = (0..128_u8).map(Some).collect();
let a = a.slice(63, 65);
let a = a.as_any().downcast_ref::<UInt8Array>().unwrap();

let b: UInt8Array = (0..128_u8).into_iter().map(Some).collect();
let b: UInt8Array = (0..128_u8).map(Some).collect();
let b = b.slice(63, 65);
let b = b.as_any().downcast_ref::<UInt8Array>().unwrap();

let actual = add(a, b).unwrap();
let actual: Vec<Option<u8>> = actual.iter().collect();
let expected: Vec<Option<u8>> = (63..63_u8 + 65_u8)
.into_iter()
.map(|i| Some(i + i))
.collect();
let expected: Vec<Option<u8>> =
(63..63_u8 + 65_u8).map(|i| Some(i + i)).collect();
assert_eq!(expected, actual);
}

Expand Down
2 changes: 1 addition & 1 deletion arrow-schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl fmt::Display for Schema {
}

// need to implement `Hash` manually because `HashMap` implement Eq but no `Hash`
#[allow(clippy::derive_hash_xor_eq)]
#[allow(clippy::derived_hash_with_manual_eq)]
impl Hash for Schema {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.fields.hash(state);
Expand Down
1 change: 0 additions & 1 deletion arrow/benches/boolean_append_packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ fn boolean_append_packed(c: &mut Criterion) {
let mut rng = thread_rng();
let source = rand_bytes(1024);
let ranges: Vec<_> = (0..100)
.into_iter()
.map(|_| {
let start: usize = rng.gen_range(0..1024 * 8);
let end: usize = rng.gen_range(start..1024 * 8);
Expand Down
6 changes: 3 additions & 3 deletions arrow/src/array/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ mod tests {

#[test]
fn test_fixed_size_list() -> Result<()> {
let v: Vec<i64> = (0..9).into_iter().collect();
let v: Vec<i64> = (0..9).collect();
let value_data = ArrayData::builder(DataType::Int64)
.len(9)
.add_buffer(Buffer::from_slice_ref(v))
Expand All @@ -240,7 +240,7 @@ mod tests {
bit_util::set_bit(&mut validity_bits, 2);
bit_util::set_bit(&mut validity_bits, 6);

let v: Vec<i16> = (0..16).into_iter().collect();
let v: Vec<i16> = (0..16).collect();
let value_data = ArrayData::builder(DataType::Int16)
.len(16)
.add_buffer(Buffer::from_slice_ref(v))
Expand All @@ -260,7 +260,7 @@ mod tests {

#[test]
fn test_fixed_size_list_nested() -> Result<()> {
let v: Vec<i32> = (0..16).into_iter().collect();
let v: Vec<i32> = (0..16).collect();
let value_data = ArrayData::builder(DataType::Int32)
.len(16)
.add_buffer(Buffer::from_slice_ref(v))
Expand Down
2 changes: 1 addition & 1 deletion arrow/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ mod tests {
let mut validity_bits: [u8; 1] = [0; 1];
bit_util::set_bit(&mut validity_bits, 2);

let v: Vec<i32> = (0..9).into_iter().collect();
let v: Vec<i32> = (0..9).collect();
let value_data = ArrayData::builder(DataType::Int32)
.len(9)
.add_buffer(Buffer::from_slice_ref(&v))
Expand Down
1 change: 0 additions & 1 deletion arrow/tests/array_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ fn get_all_types() -> Vec<DataType> {
Dictionary(Box::new(key_type), Box::new(Decimal256(76, 0))),
]
})
.into_iter()
.collect::<Vec<_>>();

types.append(&mut dictionary_types);
Expand Down
2 changes: 0 additions & 2 deletions parquet/src/arrow/async_reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ impl<'a> InMemoryRowGroup<'a> {
.iter()
.zip(self.metadata.columns())
.enumerate()
.into_iter()
.filter_map(|(idx, (chunk, chunk_meta))| {
(chunk.is_none() && projection.leaf_included(idx)).then(|| {
// If the first page does not start at the beginning of the column,
Expand Down Expand Up @@ -671,7 +670,6 @@ impl<'a> InMemoryRowGroup<'a> {
.column_chunks
.iter()
.enumerate()
.into_iter()
.filter_map(|(idx, chunk)| {
(chunk.is_none() && projection.leaf_included(idx)).then(|| {
let column = self.metadata.column(idx);
Expand Down

0 comments on commit de9f826

Please sign in to comment.