From 460ea8ca8b10436c6865be85f4e17e6cdaf6f781 Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Thu, 5 Jan 2023 05:30:00 +0000 Subject: [PATCH] Improved clippy --- benches/aggregate.rs | 16 +++---- benches/arithmetic_kernels.rs | 6 +-- benches/assign_ops.rs | 8 ++-- benches/bitmap.rs | 12 ++--- benches/bitmap_assign_ops.rs | 8 ++-- benches/bitmap_ops.rs | 10 ++-- benches/bitwise.rs | 8 ++-- benches/comparison_kernels.rs | 12 ++--- benches/concatenate.rs | 8 ++-- benches/count_zeros.rs | 4 +- benches/filter_kernels.rs | 6 +-- benches/hash_kernel.rs | 10 ++-- benches/iter_list.rs | 4 +- benches/iter_utf8.rs | 4 +- benches/read_json.rs | 8 ++-- benches/read_parquet.rs | 31 ++++++------ benches/slices_iterator.rs | 2 +- benches/sort_kernel.rs | 12 ++--- benches/take_kernels.rs | 18 +++---- benches/unset_count.rs | 4 +- benches/write_csv.rs | 6 +-- benches/write_json.rs | 6 +-- examples/avro_read.rs | 2 +- examples/csv_read.rs | 2 +- examples/csv_read_parallel.rs | 2 +- examples/json_read.rs | 2 +- examples/ndjson_read.rs | 2 +- examples/parquet_read.rs | 2 +- src/array/binary/fmt.rs | 2 +- src/array/dictionary/fmt.rs | 2 +- src/array/fixed_size_list/mutable.rs | 2 +- src/array/fmt.rs | 4 +- src/array/list/fmt.rs | 2 +- src/array/ord.rs | 6 +-- src/array/primitive/fmt.rs | 14 +++--- src/array/specification.rs | 6 +-- src/array/utf8/fmt.rs | 2 +- src/bitmap/utils/fmt.rs | 2 +- src/compute/arithmetics/decimal/add.rs | 3 +- src/compute/arithmetics/decimal/div.rs | 6 +-- src/compute/arithmetics/decimal/mul.rs | 6 +-- src/compute/arithmetics/decimal/sub.rs | 3 +- src/compute/cast/mod.rs | 36 +++++--------- src/compute/contains.rs | 3 +- src/compute/hash.rs | 3 +- src/compute/like.rs | 21 ++++---- src/compute/regex_match.rs | 5 +- src/compute/sort/mod.rs | 15 ++---- src/compute/sort/row/dictionary.rs | 3 +- src/compute/sort/row/mod.rs | 3 +- src/compute/take/boolean.rs | 2 +- src/compute/take/primitive.rs | 2 +- src/error.rs | 8 ++-- src/ffi/schema.rs | 16 +++---- src/io/avro/read/deserialize.rs | 3 +- src/io/avro/read/schema.rs | 3 +- src/io/avro/write/mod.rs | 2 +- src/io/avro/write/schema.rs | 5 +- src/io/csv/read_utils.rs | 3 +- src/io/csv/utils.rs | 2 +- src/io/csv/write/serialize.rs | 10 ++-- src/io/flight/mod.rs | 5 +- src/io/ipc/read/array/binary.rs | 3 +- src/io/ipc/read/array/boolean.rs | 3 +- src/io/ipc/read/array/dictionary.rs | 3 +- src/io/ipc/read/array/fixed_size_binary.rs | 3 +- src/io/ipc/read/array/fixed_size_list.rs | 3 +- src/io/ipc/read/array/list.rs | 3 +- src/io/ipc/read/array/map.rs | 3 +- src/io/ipc/read/array/null.rs | 3 +- src/io/ipc/read/array/primitive.rs | 3 +- src/io/ipc/read/array/struct_.rs | 3 +- src/io/ipc/read/array/union.rs | 3 +- src/io/ipc/read/array/utf8.rs | 3 +- src/io/ipc/read/error.rs | 2 +- src/io/ipc/read/file.rs | 2 +- src/io/ipc/read/schema.rs | 7 ++- src/io/json/read/deserialize.rs | 2 +- src/io/json/read/infer_schema.rs | 2 +- src/io/json/write/serialize.rs | 4 +- src/io/json_integration/read/array.rs | 2 +- src/io/json_integration/read/schema.rs | 12 ++--- src/io/ndjson/read/file.rs | 2 +- src/io/orc/mod.rs | 2 +- .../read/deserialize/dictionary/mod.rs | 4 +- .../read/deserialize/dictionary/nested.rs | 4 +- src/io/parquet/read/deserialize/nested.rs | 3 +- src/io/parquet/read/deserialize/simple.rs | 12 ++--- src/io/parquet/read/deserialize/utils.rs | 4 +- src/io/parquet/read/schema/convert.rs | 2 +- src/io/parquet/read/schema/metadata.rs | 3 +- src/io/parquet/read/statistics/mod.rs | 9 ++-- src/io/parquet/write/dictionary.rs | 3 +- src/io/parquet/write/mod.rs | 9 ++-- src/io/parquet/write/schema.rs | 3 +- src/temporal_conversions.rs | 2 +- tests/it/array/binary/mod.rs | 2 +- tests/it/array/boolean/mod.rs | 2 +- tests/it/array/dictionary/mod.rs | 8 ++-- tests/it/array/equal/mod.rs | 8 ++-- tests/it/array/fixed_size_binary/mod.rs | 2 +- tests/it/array/fixed_size_list/mod.rs | 2 +- tests/it/array/list/mod.rs | 4 +- tests/it/array/primitive/fmt.rs | 48 +++++++++---------- tests/it/array/struct_/mod.rs | 2 +- tests/it/array/union.rs | 4 +- tests/it/array/utf8/mod.rs | 2 +- tests/it/bitmap/immutable.rs | 2 +- tests/it/bitmap/mutable.rs | 8 ++-- tests/it/buffer/immutable.rs | 2 +- tests/it/compute/cast.rs | 7 ++- tests/it/io/csv/write.rs | 4 +- tests/it/io/ipc/common.rs | 6 +-- tests/it/io/ipc/read/file.rs | 12 ++--- tests/it/io/ipc/read/stream.rs | 6 +-- tests/it/io/ipc/read_file_async.rs | 3 +- tests/it/io/ipc/read_stream_async.rs | 3 +- tests/it/io/parquet/read.rs | 8 ++-- tests/it/io/print.rs | 12 ++--- tests/it/temporal_conversions.rs | 22 ++++----- 120 files changed, 325 insertions(+), 410 deletions(-) diff --git a/benches/aggregate.rs b/benches/aggregate.rs index f157550d153..ac5002d31e9 100644 --- a/benches/aggregate.rs +++ b/benches/aggregate.rs @@ -17,41 +17,41 @@ fn add_benchmark(c: &mut Criterion) { let size = 2usize.pow(log2_size); let arr_a = create_primitive_array::(size, 0.0); - c.bench_function(&format!("sum 2^{} f32", log2_size), |b| { + c.bench_function(&format!("sum 2^{log2_size} f32"), |b| { b.iter(|| bench_sum(&arr_a)) }); - c.bench_function(&format!("min 2^{} f32", log2_size), |b| { + c.bench_function(&format!("min 2^{log2_size} f32"), |b| { b.iter(|| bench_min(&arr_a)) }); let arr_a = create_primitive_array::(size, 0.0); - c.bench_function(&format!("sum 2^{} i32", log2_size), |b| { + c.bench_function(&format!("sum 2^{log2_size} i32"), |b| { b.iter(|| bench_sum(&arr_a)) }); - c.bench_function(&format!("min 2^{} i32", log2_size), |b| { + c.bench_function(&format!("min 2^{log2_size} i32"), |b| { b.iter(|| bench_min(&arr_a)) }); let arr_a = create_primitive_array::(size, 0.1); - c.bench_function(&format!("sum null 2^{} f32", log2_size), |b| { + c.bench_function(&format!("sum null 2^{log2_size} f32"), |b| { b.iter(|| bench_sum(&arr_a)) }); - c.bench_function(&format!("min null 2^{} f32", log2_size), |b| { + c.bench_function(&format!("min null 2^{log2_size} f32"), |b| { b.iter(|| bench_min(&arr_a)) }); let arr_a = create_string_array::(1, size, 0.0, 0); - c.bench_function(&format!("min 2^{} utf8", log2_size), |b| { + c.bench_function(&format!("min 2^{log2_size} utf8"), |b| { b.iter(|| bench_min(&arr_a)) }); let arr_a = create_string_array::(1, size, 0.1, 0); - c.bench_function(&format!("min null 2^{} utf8", log2_size), |b| { + c.bench_function(&format!("min null 2^{log2_size} utf8"), |b| { b.iter(|| bench_min(&arr_a)) }); }); diff --git a/benches/arithmetic_kernels.rs b/benches/arithmetic_kernels.rs index c96b3ea288c..950a08b10fb 100644 --- a/benches/arithmetic_kernels.rs +++ b/benches/arithmetic_kernels.rs @@ -27,16 +27,16 @@ fn add_benchmark(c: &mut Criterion) { let arr_a = create_primitive_array_with_seed::(size, 0.0, 43); let arr_b = create_primitive_array_with_seed::(size, 0.0, 42); - c.bench_function(&format!("divide_scalar 2^{}", log2_size), |b| { + c.bench_function(&format!("divide_scalar 2^{log2_size}"), |b| { // 4 is a very fast optimizable divisor b.iter(|| bench_div_scalar(&arr_a, &4)) }); - c.bench_function(&format!("divide_scalar prime 2^{}", log2_size), |b| { + c.bench_function(&format!("divide_scalar prime 2^{log2_size}"), |b| { // large prime number that is probably harder to simplify b.iter(|| bench_div_scalar(&arr_a, &524287)) }); - c.bench_function(&format!("add 2^{}", log2_size), |b| { + c.bench_function(&format!("add 2^{log2_size}"), |b| { b.iter(|| bench_add(&arr_a, &arr_b)) }); }); diff --git a/benches/assign_ops.rs b/benches/assign_ops.rs index 7b169ec42df..5c190e43c5d 100644 --- a/benches/assign_ops.rs +++ b/benches/assign_ops.rs @@ -11,7 +11,7 @@ fn add_benchmark(c: &mut Criterion) { let size = 2usize.pow(log2_size); let mut arr_a = create_primitive_array::(size, 0.2); - c.bench_function(&format!("apply_mul 2^{}", log2_size), |b| { + c.bench_function(&format!("apply_mul 2^{log2_size}"), |b| { b.iter(|| { unary(criterion::black_box(&mut arr_a), |x| x * 1.01); assert!(!arr_a.value(10).is_nan()); @@ -19,7 +19,7 @@ fn add_benchmark(c: &mut Criterion) { }); let arr_a = create_primitive_array::(size, 0.2); - c.bench_function(&format!("mul 2^{}", log2_size), |b| { + c.bench_function(&format!("mul 2^{log2_size}"), |b| { b.iter(|| { let a = mul_scalar(criterion::black_box(&arr_a), &1.01f32); assert!(!a.value(10).is_nan()); @@ -31,7 +31,7 @@ fn add_benchmark(c: &mut Criterion) { // convert to be close to 1.01 unary(&mut arr_b, |x| 1.01 + x / 20.0); - c.bench_function(&format!("apply_mul null 2^{}", log2_size), |b| { + c.bench_function(&format!("apply_mul null 2^{log2_size}"), |b| { b.iter(|| { binary(criterion::black_box(&mut arr_a), &arr_b, |x, y| x * y); assert!(!arr_a.value(10).is_nan()); @@ -39,7 +39,7 @@ fn add_benchmark(c: &mut Criterion) { }); let arr_a = create_primitive_array::(size, 0.2); - c.bench_function(&format!("mul null 2^{}", log2_size), |b| { + c.bench_function(&format!("mul null 2^{log2_size}"), |b| { b.iter(|| { let a = mul(criterion::black_box(&arr_a), &arr_b); assert!(!a.value(10).is_nan()); diff --git a/benches/bitmap.rs b/benches/bitmap.rs index 4f77bb3ac87..5fde7fca77f 100644 --- a/benches/bitmap.rs +++ b/benches/bitmap.rs @@ -10,7 +10,7 @@ fn add_benchmark(c: &mut Criterion) { let bitmap2 = Bitmap::from_iter((0..size).into_iter().map(|x| x % 3 == 0)); - c.bench_function(&format!("bitmap extend aligned 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap extend aligned 2^{log2_size}"), |b| { let mut bitmap1 = MutableBitmap::new(); b.iter(|| { bitmap1.extend_from_bitmap(&bitmap2); @@ -18,7 +18,7 @@ fn add_benchmark(c: &mut Criterion) { }) }); - c.bench_function(&format!("bitmap extend unaligned 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap extend unaligned 2^{log2_size}"), |b| { let mut bitmap1 = MutableBitmap::with_capacity(1); b.iter(|| { bitmap1.push(true); @@ -28,7 +28,7 @@ fn add_benchmark(c: &mut Criterion) { }); c.bench_function( - &format!("bitmap extend_constant aligned 2^{}", log2_size), + &format!("bitmap extend_constant aligned 2^{log2_size}"), |b| { let mut bitmap1 = MutableBitmap::new(); b.iter(|| { @@ -39,7 +39,7 @@ fn add_benchmark(c: &mut Criterion) { ); c.bench_function( - &format!("bitmap extend_constant unaligned 2^{}", log2_size), + &format!("bitmap extend_constant unaligned 2^{log2_size}"), |b| { let mut bitmap1 = MutableBitmap::with_capacity(1); b.iter(|| { @@ -54,14 +54,14 @@ fn add_benchmark(c: &mut Criterion) { .into_iter() .map(|x| x % 3 == 0) .collect::>(); - c.bench_function(&format!("bitmap from_trusted_len 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap from_trusted_len 2^{log2_size}"), |b| { b.iter(|| { MutableBitmap::from_trusted_len_iter(iter.iter().copied()); }) }); c.bench_function( - &format!("bitmap extend_from_trusted_len_iter 2^{}", log2_size), + &format!("bitmap extend_from_trusted_len_iter 2^{log2_size}"), |b| { b.iter(|| { let mut a = MutableBitmap::from(&[true]); diff --git a/benches/bitmap_assign_ops.rs b/benches/bitmap_assign_ops.rs index c962e8ed950..926be0a60e9 100644 --- a/benches/bitmap_assign_ops.rs +++ b/benches/bitmap_assign_ops.rs @@ -8,7 +8,7 @@ fn add_benchmark(c: &mut Criterion) { let size = 2usize.pow(log2_size); let mut bitmap: MutableBitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect(); - c.bench_function(&format!("mutablebitmap not 2^{}", log2_size), |b| { + c.bench_function(&format!("mutablebitmap not 2^{log2_size}"), |b| { b.iter(|| { unary_assign(criterion::black_box(&mut bitmap), |x: u64| !x); assert!(!bitmap.is_empty()); @@ -16,7 +16,7 @@ fn add_benchmark(c: &mut Criterion) { }); let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect(); - c.bench_function(&format!("bitmap not 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap not 2^{log2_size}"), |b| { b.iter(|| { let r = !criterion::black_box(&bitmap); assert!(!r.is_empty()); @@ -25,7 +25,7 @@ fn add_benchmark(c: &mut Criterion) { let mut lhs: MutableBitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect(); let rhs: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect(); - c.bench_function(&format!("mutablebitmap and 2^{}", log2_size), |b| { + c.bench_function(&format!("mutablebitmap and 2^{log2_size}"), |b| { b.iter(|| { binary_assign(criterion::black_box(&mut lhs), &rhs, |x: u64, y| x & y); assert!(!bitmap.is_empty()); @@ -34,7 +34,7 @@ fn add_benchmark(c: &mut Criterion) { let lhs: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect(); let rhs: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect(); - c.bench_function(&format!("bitmap and 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap and 2^{log2_size}"), |b| { b.iter(|| { let r = criterion::black_box(&lhs) & &rhs; assert!(!r.is_empty()); diff --git a/benches/bitmap_ops.rs b/benches/bitmap_ops.rs index dcd38661bfb..f1fd06f195a 100644 --- a/benches/bitmap_ops.rs +++ b/benches/bitmap_ops.rs @@ -12,7 +12,7 @@ fn add_benchmark(c: &mut Criterion) { let size = 2usize.pow(log2_size); let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect(); - c.bench_function(&format!("bitmap aligned not 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap aligned not 2^{log2_size}"), |b| { b.iter(|| { let r = !&bitmap; assert!(r.unset_bits() > 0); @@ -23,7 +23,7 @@ fn add_benchmark(c: &mut Criterion) { let len = ((size as f64) * 0.85) as usize; c.bench_function( - &format!("bitmap count zeros 85% slice 2^{}", log2_size), + &format!("bitmap count zeros 85% slice 2^{log2_size}"), |b| { b.iter(|| { let r = bitmap.clone().slice(offset, len); @@ -36,7 +36,7 @@ fn add_benchmark(c: &mut Criterion) { let len = ((size as f64) * 0.51) as usize; c.bench_function( - &format!("bitmap count zeros 51% slice 2^{}", log2_size), + &format!("bitmap count zeros 51% slice 2^{log2_size}"), |b| { b.iter(|| { let r = bitmap.clone().slice(offset, len); @@ -46,7 +46,7 @@ fn add_benchmark(c: &mut Criterion) { ); let bitmap1 = bitmap.clone().slice(1, size - 1); - c.bench_function(&format!("bitmap not 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap not 2^{log2_size}"), |b| { b.iter(|| { let r = !&bitmap1; assert!(r.unset_bits() > 0); @@ -54,7 +54,7 @@ fn add_benchmark(c: &mut Criterion) { }); let bitmap1: Bitmap = (0..size).into_iter().map(|x| x % 4 == 0).collect(); - c.bench_function(&format!("bitmap aligned or 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap aligned or 2^{log2_size}"), |b| { b.iter(|| bench_arrow2(&bitmap, &bitmap1)) }); }); diff --git a/benches/bitwise.rs b/benches/bitwise.rs index 4e1fc9f82dd..704e32aac77 100644 --- a/benches/bitwise.rs +++ b/benches/bitwise.rs @@ -42,19 +42,19 @@ fn add_benchmark(c: &mut Criterion) { let arr_a = create_primitive_array_with_seed::(size, 0.0, 43); let arr_b = create_primitive_array_with_seed::(size, 0.0, 42); - c.bench_function(&format!("or 2^{}", log2_size), |b| { + c.bench_function(&format!("or 2^{log2_size}"), |b| { b.iter(|| bench_or(&arr_a, &arr_b)) }); - c.bench_function(&format!("xor 2^{}", log2_size), |b| { + c.bench_function(&format!("xor 2^{log2_size}"), |b| { b.iter(|| bench_xor(&arr_a, &arr_b)) }); - c.bench_function(&format!("and 2^{}", log2_size), |b| { + c.bench_function(&format!("and 2^{log2_size}"), |b| { b.iter(|| bench_and(&arr_a, &arr_b)) }); - c.bench_function(&format!("not 2^{}", log2_size), |b| { + c.bench_function(&format!("not 2^{log2_size}"), |b| { b.iter(|| bench_not(&arr_a)) }); }); diff --git a/benches/comparison_kernels.rs b/benches/comparison_kernels.rs index 1371471d2cf..cbea8f8f74d 100644 --- a/benches/comparison_kernels.rs +++ b/benches/comparison_kernels.rs @@ -11,30 +11,30 @@ fn add_benchmark(c: &mut Criterion) { let arr_a = create_primitive_array_with_seed::(size, 0.0, 42); let arr_b = create_primitive_array_with_seed::(size, 0.0, 43); - c.bench_function(&format!("f32 2^{}", log2_size), |b| { + c.bench_function(&format!("f32 2^{log2_size}"), |b| { b.iter(|| eq(&arr_a, &arr_b)) }); - c.bench_function(&format!("f32 scalar 2^{}", log2_size), |b| { + c.bench_function(&format!("f32 scalar 2^{log2_size}"), |b| { b.iter(|| eq_scalar(&arr_a, &PrimitiveScalar::::from(Some(0.5)))) }); let arr_a = create_boolean_array(size, 0.0, 0.1); let arr_b = create_boolean_array(size, 0.0, 0.2); - c.bench_function(&format!("bool 2^{}", log2_size), |b| { + c.bench_function(&format!("bool 2^{log2_size}"), |b| { b.iter(|| eq(&arr_a, &arr_b)) }); - c.bench_function(&format!("bool scalar 2^{}", log2_size), |b| { + c.bench_function(&format!("bool scalar 2^{log2_size}"), |b| { b.iter(|| eq_scalar(&arr_a, &BooleanScalar::from(Some(false)))) }); let arr_a = create_string_array::(size, 4, 0.1, 42); let arr_b = create_string_array::(size, 4, 0.1, 43); - c.bench_function(&format!("utf8 2^{}", log2_size), |b| { + c.bench_function(&format!("utf8 2^{log2_size}"), |b| { b.iter(|| eq(&arr_a, &arr_b)) }); - c.bench_function(&format!("utf8 2^{}", log2_size), |b| { + c.bench_function(&format!("utf8 2^{log2_size}"), |b| { b.iter(|| eq_scalar(&arr_a, &Utf8Scalar::::from(Some("abc")))) }); }) diff --git a/benches/concatenate.rs b/benches/concatenate.rs index 7a6148f4553..b2e3713d447 100644 --- a/benches/concatenate.rs +++ b/benches/concatenate.rs @@ -12,7 +12,7 @@ fn add_benchmark(c: &mut Criterion) { let array1 = create_primitive_array::(8, 0.5); let array2 = create_primitive_array::(size + 1, 0.5); - c.bench_function(&format!("int32 concat aligned 2^{}", log2_size), |b| { + c.bench_function(&format!("int32 concat aligned 2^{log2_size}"), |b| { b.iter(|| { let _ = concatenate(&[&array1, &array2]); }) @@ -20,7 +20,7 @@ fn add_benchmark(c: &mut Criterion) { let array1 = create_primitive_array::(9, 0.5); - c.bench_function(&format!("int32 concat unaligned 2^{}", log2_size), |b| { + c.bench_function(&format!("int32 concat unaligned 2^{log2_size}"), |b| { b.iter(|| { let _ = concatenate(&[&array1, &array2]); }) @@ -29,7 +29,7 @@ fn add_benchmark(c: &mut Criterion) { let array1 = create_boolean_array(8, 0.5, 0.5); let array2 = create_boolean_array(size + 1, 0.5, 0.5); - c.bench_function(&format!("boolean concat aligned 2^{}", log2_size), |b| { + c.bench_function(&format!("boolean concat aligned 2^{log2_size}"), |b| { b.iter(|| { let _ = concatenate(&[&array1, &array2]); }) @@ -37,7 +37,7 @@ fn add_benchmark(c: &mut Criterion) { let array1 = create_boolean_array(9, 0.5, 0.5); - c.bench_function(&format!("boolean concat unaligned 2^{}", log2_size), |b| { + c.bench_function(&format!("boolean concat unaligned 2^{log2_size}"), |b| { b.iter(|| { let _ = concatenate(&[&array1, &array2]); }) diff --git a/benches/count_zeros.rs b/benches/count_zeros.rs index 069fa40315b..38d1570d213 100644 --- a/benches/count_zeros.rs +++ b/benches/count_zeros.rs @@ -10,11 +10,11 @@ fn add_benchmark(c: &mut Criterion) { .map(|x| 0b01011011u8.rotate_left(x)) .collect::>(); - c.bench_function(&format!("count_zeros 2^{}", log2_size), |b| { + c.bench_function(&format!("count_zeros 2^{log2_size}"), |b| { b.iter(|| count_zeros(&bytes, 0, bytes.len() * 8)) }); - c.bench_function(&format!("count_zeros offset 2^{}", log2_size), |b| { + c.bench_function(&format!("count_zeros offset 2^{log2_size}"), |b| { b.iter(|| count_zeros(&bytes, 10, bytes.len() * 8 - 10)) }); }) diff --git a/benches/filter_kernels.rs b/benches/filter_kernels.rs index 3d61a0cbb03..97e8dc320cd 100644 --- a/benches/filter_kernels.rs +++ b/benches/filter_kernels.rs @@ -26,7 +26,7 @@ fn bench_filter(data_array: &dyn Array, filter_array: &BooleanArray) { criterion::black_box(filter(data_array, filter_array).unwrap()); } -fn bench_built_filter<'a>(filter: &Filter<'a>, array: &dyn Array) { +fn bench_built_filter(filter: &Filter, array: &dyn Array) { criterion::black_box(filter(array)); } @@ -40,13 +40,13 @@ fn add_benchmark(c: &mut Criterion) { BooleanArray::new(DataType::Boolean, filter_array.values().clone(), None); let arr_a = create_primitive_array::(size, 0.0); - c.bench_function(&format!("filter 2^{} f32", log2_size), |b| { + c.bench_function(&format!("filter 2^{log2_size} f32"), |b| { b.iter(|| bench_filter(&arr_a, &filter_array)) }); let arr_a = create_primitive_array::(size, 0.1); - c.bench_function(&format!("filter null 2^{} f32", log2_size), |b| { + c.bench_function(&format!("filter null 2^{log2_size} f32"), |b| { b.iter(|| bench_filter(&arr_a, &filter_array)) }); }); diff --git a/benches/hash_kernel.rs b/benches/hash_kernel.rs index bf129db6fe1..81119b3aaf9 100644 --- a/benches/hash_kernel.rs +++ b/benches/hash_kernel.rs @@ -9,21 +9,19 @@ fn add_benchmark(c: &mut Criterion) { let arr_a = create_primitive_array::(size, 0.0); - c.bench_function(&format!("i32 2^{}", log2_size), |b| b.iter(|| hash(&arr_a))); + c.bench_function(&format!("i32 2^{log2_size}"), |b| b.iter(|| hash(&arr_a))); let arr_a = create_primitive_array::(size, 0.0); - c.bench_function(&format!("i64 2^{}", log2_size), |b| b.iter(|| hash(&arr_a))); + c.bench_function(&format!("i64 2^{log2_size}"), |b| b.iter(|| hash(&arr_a))); let arr_a = create_string_array::(size, 5, 0.0, 0); - c.bench_function(&format!("str 2^{}", log2_size), |b| b.iter(|| hash(&arr_a))); + c.bench_function(&format!("str 2^{log2_size}"), |b| b.iter(|| hash(&arr_a))); let arr_a = create_boolean_array(size, 0.5, 0.0); - c.bench_function(&format!("bool 2^{}", log2_size), |b| { - b.iter(|| hash(&arr_a)) - }); + c.bench_function(&format!("bool 2^{log2_size}"), |b| b.iter(|| hash(&arr_a))); } criterion_group!(benches, add_benchmark); diff --git a/benches/iter_list.rs b/benches/iter_list.rs index 44482567dde..43b7698f3e5 100644 --- a/benches/iter_list.rs +++ b/benches/iter_list.rs @@ -30,7 +30,7 @@ fn add_benchmark(c: &mut Criterion) { Some(validity), ); - c.bench_function(&format!("list: iter_values 2^{}", log2_size), |b| { + c.bench_function(&format!("list: iter_values 2^{log2_size}"), |b| { b.iter(|| { for x in array.values_iter() { assert_eq!(x.len(), 2); @@ -38,7 +38,7 @@ fn add_benchmark(c: &mut Criterion) { }) }); - c.bench_function(&format!("list: iter 2^{}", log2_size), |b| { + c.bench_function(&format!("list: iter 2^{log2_size}"), |b| { b.iter(|| { for x in array.iter() { assert_eq!(x.unwrap().len(), 2); diff --git a/benches/iter_utf8.rs b/benches/iter_utf8.rs index 44a85d24606..d80ba123890 100644 --- a/benches/iter_utf8.rs +++ b/benches/iter_utf8.rs @@ -12,7 +12,7 @@ fn add_benchmark(c: &mut Criterion) { .chain(std::iter::repeat("bbb").take(size / 2)), ); - c.bench_function(&format!("iter_values 2^{}", log2_size), |b| { + c.bench_function(&format!("iter_values 2^{log2_size}"), |b| { b.iter(|| { for x in array.values_iter() { assert_eq!(x.len(), 3); @@ -20,7 +20,7 @@ fn add_benchmark(c: &mut Criterion) { }) }); - c.bench_function(&format!("iter 2^{}", log2_size), |b| { + c.bench_function(&format!("iter 2^{log2_size}"), |b| { b.iter(|| { for x in array.iter() { assert_eq!(x.unwrap().len(), 3); diff --git a/benches/read_json.rs b/benches/read_json.rs index 5d0400c5921..0da79b9437a 100644 --- a/benches/read_json.rs +++ b/benches/read_json.rs @@ -33,7 +33,7 @@ fn add_benchmark(c: &mut Criterion) { let (data, dt) = prep(array); - c.bench_function(&format!("read i32 2^{}", log2_size), |b| { + c.bench_function(&format!("read i32 2^{log2_size}"), |b| { b.iter(|| bench_read(&data, &dt)) }); @@ -41,7 +41,7 @@ fn add_benchmark(c: &mut Criterion) { let (data, dt) = prep(array); - c.bench_function(&format!("read f64 2^{}", log2_size), |b| { + c.bench_function(&format!("read f64 2^{log2_size}"), |b| { b.iter(|| bench_read(&data, &dt)) }); @@ -49,7 +49,7 @@ fn add_benchmark(c: &mut Criterion) { let (data, dt) = prep(array); - c.bench_function(&format!("read utf8 2^{}", log2_size), |b| { + c.bench_function(&format!("read utf8 2^{log2_size}"), |b| { b.iter(|| bench_read(&data, &dt)) }); @@ -57,7 +57,7 @@ fn add_benchmark(c: &mut Criterion) { let (data, dt) = prep(array); - c.bench_function(&format!("read bool 2^{}", log2_size), |b| { + c.bench_function(&format!("read bool 2^{log2_size}"), |b| { b.iter(|| bench_read(&data, &dt)) }); }) diff --git a/benches/read_parquet.rs b/benches/read_parquet.rs index 0f445fbb01b..5aa16963601 100644 --- a/benches/read_parquet.rs +++ b/benches/read_parquet.rs @@ -21,8 +21,7 @@ fn to_buffer( let nullable = if nullable { "" } else { "_required" }; let path = PathBuf::from(dir).join(format!( - "fixtures/pyarrow3/v1/{}{}{}benches{}_{}.parquet", - dict, multi_page, compressed, nullable, size + "fixtures/pyarrow3/v1/{dict}{multi_page}{compressed}benches{nullable}_{size}.parquet", )); let metadata = fs::metadata(&path).expect("unable to read metadata"); @@ -51,50 +50,50 @@ fn read_chunk(buffer: &[u8], size: usize, column: usize) -> Result<()> { } fn add_benchmark(c: &mut Criterion) { - (10..=20).step_by(2).for_each(|i| { - let size = 2usize.pow(i); + (10..=20).step_by(2).for_each(|log2_size| { + let size = 2usize.pow(log2_size); let buffer = to_buffer(size, true, false, false, false); - let a = format!("read i64 2^{}", i); + let a = format!("read i64 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 0).unwrap())); let buffer = to_buffer(size, true, true, false, false); - let a = format!("read ts dict 2^{}", i); + let a = format!("read ts dict 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 11).unwrap())); - let a = format!("read utf8 2^{}", i); + let a = format!("read utf8 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 2).unwrap())); - let a = format!("read utf8 large 2^{}", i); + let a = format!("read utf8 large 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 6).unwrap())); - let a = format!("read utf8 emoji 2^{}", i); + let a = format!("read utf8 emoji 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 12).unwrap())); - let a = format!("read bool 2^{}", i); + let a = format!("read bool 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 3).unwrap())); let buffer = to_buffer(size, true, true, false, false); - let a = format!("read utf8 dict 2^{}", i); + let a = format!("read utf8 dict 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 2).unwrap())); let buffer = to_buffer(size, true, false, false, true); - let a = format!("read i64 snappy 2^{}", i); + let a = format!("read i64 snappy 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 0).unwrap())); let buffer = to_buffer(size, true, false, true, false); - let a = format!("read utf8 multi 2^{}", i); + let a = format!("read utf8 multi 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 2).unwrap())); let buffer = to_buffer(size, true, false, true, true); - let a = format!("read utf8 multi snappy 2^{}", i); + let a = format!("read utf8 multi snappy 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 2).unwrap())); let buffer = to_buffer(size, true, false, true, true); - let a = format!("read i64 multi snappy 2^{}", i); + let a = format!("read i64 multi snappy 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 0).unwrap())); let buffer = to_buffer(size, false, false, false, false); - let a = format!("read required utf8 2^{}", i); + let a = format!("read required utf8 2^{log2_size}"); c.bench_function(&a, |b| b.iter(|| read_chunk(&buffer, size, 2).unwrap())); }); } diff --git a/benches/slices_iterator.rs b/benches/slices_iterator.rs index 4a4e81e27ae..cea662d16a9 100644 --- a/benches/slices_iterator.rs +++ b/benches/slices_iterator.rs @@ -15,7 +15,7 @@ fn add_benchmark(c: &mut Criterion) { let size = 2usize.pow(log2_size); let bitmap: Bitmap = (0..size).into_iter().map(|x| x % 3 == 0).collect(); - c.bench_function(&format!("bitmap slices 2^{}", log2_size), |b| { + c.bench_function(&format!("bitmap slices 2^{log2_size}"), |b| { b.iter(|| bench_slices(&bitmap)) }); }); diff --git a/benches/sort_kernel.rs b/benches/sort_kernel.rs index b0736a27562..562d7d7b444 100644 --- a/benches/sort_kernel.rs +++ b/benches/sort_kernel.rs @@ -54,32 +54,32 @@ fn add_benchmark(c: &mut Criterion) { let size = 2usize.pow(log2_size); let arr_a = create_primitive_array::(size, 0.0); - c.bench_function(&format!("sort 2^{} f32", log2_size), |b| { + c.bench_function(&format!("sort 2^{log2_size} f32"), |b| { b.iter(|| bench_sort(&arr_a)) }); - c.bench_function(&format!("sort-limit 2^{} f32", log2_size), |b| { + c.bench_function(&format!("sort-limit 2^{log2_size} f32"), |b| { b.iter(|| bench_sort_limit(&arr_a)) }); let arr_b = create_primitive_array_with_seed::(size, 0.0, 43); - c.bench_function(&format!("lexsort 2^{} f32", log2_size), |b| { + c.bench_function(&format!("lexsort 2^{log2_size} f32"), |b| { b.iter(|| bench_lexsort(&arr_a, &arr_b)) }); let arr_a = create_primitive_array::(size, 0.5); - c.bench_function(&format!("sort null 2^{} f32", log2_size), |b| { + c.bench_function(&format!("sort null 2^{log2_size} f32"), |b| { b.iter(|| bench_sort(&arr_a)) }); let arr_b = create_primitive_array_with_seed::(size, 0.5, 43); - c.bench_function(&format!("lexsort null 2^{} f32", log2_size), |b| { + c.bench_function(&format!("lexsort null 2^{log2_size} f32"), |b| { b.iter(|| bench_lexsort(&arr_a, &arr_b)) }); let arr_a = create_string_array::(size, 4, 0.1, 42); - c.bench_function(&format!("sort utf8 null 2^{}", log2_size), |b| { + c.bench_function(&format!("sort utf8 null 2^{log2_size}"), |b| { b.iter(|| bench_sort(&arr_a)) }); }); diff --git a/benches/take_kernels.rs b/benches/take_kernels.rs index 0ae1e482965..f18e091d12a 100644 --- a/benches/take_kernels.rs +++ b/benches/take_kernels.rs @@ -32,43 +32,43 @@ fn add_benchmark(c: &mut Criterion) { let values_nulls = create_primitive_array::(size, 0.2); let indices = create_random_index(size, 0.0); let indices_nulls = create_random_index(size, 0.5); - c.bench_function(&format!("take i32 2^{}", log2_size), |b| { + c.bench_function(&format!("take i32 2^{log2_size}"), |b| { b.iter(|| bench_take(&values, &indices)) }); - c.bench_function(&format!("take i32 nulls 2^{}", log2_size), |b| { + c.bench_function(&format!("take i32 nulls 2^{log2_size}"), |b| { b.iter(|| bench_take(&values, &indices_nulls)) }); - c.bench_function(&format!("take i32 values nulls 2^{}", log2_size), |b| { + c.bench_function(&format!("take i32 values nulls 2^{log2_size}"), |b| { b.iter(|| bench_take(&values_nulls, &indices)) }); let values = create_boolean_array(size, 0.0, 0.5); - c.bench_function(&format!("take bool 2^{}", log2_size), |b| { + c.bench_function(&format!("take bool 2^{log2_size}"), |b| { b.iter(|| bench_take(&values, &indices)) }); let values_nulls = create_boolean_array(size, 0.2, 0.5); - c.bench_function(&format!("take bool values nulls 2^{}", log2_size), |b| { + c.bench_function(&format!("take bool values nulls 2^{log2_size}"), |b| { b.iter(|| bench_take(&values_nulls, &indices)) }); - c.bench_function(&format!("take bool nulls 2^{}", log2_size), |b| { + c.bench_function(&format!("take bool nulls 2^{log2_size}"), |b| { b.iter(|| bench_take(&values, &indices_nulls)) }); let values = create_string_array::(512, 4, 0.0, 42); - c.bench_function(&format!("take str 2^{}", log2_size), |b| { + c.bench_function(&format!("take str 2^{log2_size}"), |b| { b.iter(|| bench_take(&values, &indices)) }); - c.bench_function(&format!("take str nulls 2^{}", log2_size), |b| { + c.bench_function(&format!("take str nulls 2^{log2_size}"), |b| { b.iter(|| bench_take(&values, &indices_nulls)) }); let values_nulls = create_string_array::(size, 4, 0.2, 42); - c.bench_function(&format!("take str values nulls 2^{}", log2_size), |b| { + c.bench_function(&format!("take str values nulls 2^{log2_size}"), |b| { b.iter(|| bench_take(&values_nulls, &indices)) }); }); diff --git a/benches/unset_count.rs b/benches/unset_count.rs index 069fa40315b..38d1570d213 100644 --- a/benches/unset_count.rs +++ b/benches/unset_count.rs @@ -10,11 +10,11 @@ fn add_benchmark(c: &mut Criterion) { .map(|x| 0b01011011u8.rotate_left(x)) .collect::>(); - c.bench_function(&format!("count_zeros 2^{}", log2_size), |b| { + c.bench_function(&format!("count_zeros 2^{log2_size}"), |b| { b.iter(|| count_zeros(&bytes, 0, bytes.len() * 8)) }); - c.bench_function(&format!("count_zeros offset 2^{}", log2_size), |b| { + c.bench_function(&format!("count_zeros offset 2^{log2_size}"), |b| { b.iter(|| count_zeros(&bytes, 10, bytes.len() * 8 - 10)) }); }) diff --git a/benches/write_csv.rs b/benches/write_csv.rs index ee30d9ec3a7..7778b0781f4 100644 --- a/benches/write_csv.rs +++ b/benches/write_csv.rs @@ -29,21 +29,21 @@ fn add_benchmark(c: &mut Criterion) { let array = create_primitive_array::(size, 0.1); let batch = make_chunk(array); - c.bench_function(&format!("csv write i32 2^{}", log2_size), |b| { + c.bench_function(&format!("csv write i32 2^{log2_size}"), |b| { b.iter(|| write_batch(&batch)) }); let array = create_string_array::(size, 100, 0.1, 42); let batch = make_chunk(array); - c.bench_function(&format!("csv write utf8 2^{}", log2_size), |b| { + c.bench_function(&format!("csv write utf8 2^{log2_size}"), |b| { b.iter(|| write_batch(&batch)) }); let array = create_primitive_array::(size, 0.1); let batch = make_chunk(array); - c.bench_function(&format!("csv write f64 2^{}", log2_size), |b| { + c.bench_function(&format!("csv write f64 2^{log2_size}"), |b| { b.iter(|| write_batch(&batch)) }); }); diff --git a/benches/write_json.rs b/benches/write_json.rs index ee8880546f6..d4f464040eb 100644 --- a/benches/write_json.rs +++ b/benches/write_json.rs @@ -25,19 +25,19 @@ fn add_benchmark(c: &mut Criterion) { let array = create_primitive_array::(size, 0.1); - c.bench_function(&format!("json write i32 2^{}", log2_size), |b| { + c.bench_function(&format!("json write i32 2^{log2_size}"), |b| { b.iter(|| write_array(Box::new(array.clone()))) }); let array = create_string_array::(size, 100, 0.1, 42); - c.bench_function(&format!("json write utf8 2^{}", log2_size), |b| { + c.bench_function(&format!("json write utf8 2^{log2_size}"), |b| { b.iter(|| write_array(Box::new(array.clone()))) }); let array = create_primitive_array::(size, 0.1); - c.bench_function(&format!("json write f64 2^{}", log2_size), |b| { + c.bench_function(&format!("json write f64 2^{log2_size}"), |b| { b.iter(|| write_array(Box::new(array.clone()))) }); }); diff --git a/examples/avro_read.rs b/examples/avro_read.rs index 749cf3c50db..6f45afae32f 100644 --- a/examples/avro_read.rs +++ b/examples/avro_read.rs @@ -17,7 +17,7 @@ fn main() -> Result<()> { let schema = read::infer_schema(&metadata.record)?; - println!("{:#?}", metadata); + println!("{metadata:#?}"); let reader = read::Reader::new(file, metadata, schema.fields, None); diff --git a/examples/csv_read.rs b/examples/csv_read.rs index c2661f8a6a9..21addf9d0fe 100644 --- a/examples/csv_read.rs +++ b/examples/csv_read.rs @@ -34,6 +34,6 @@ fn main() -> Result<()> { let file_path = &args[1]; let batch = read_path(file_path, None)?; - println!("{:?}", batch); + println!("{batch:?}"); Ok(()) } diff --git a/examples/csv_read_parallel.rs b/examples/csv_read_parallel.rs index 9d84d979ffc..0c3f6e2b106 100644 --- a/examples/csv_read_parallel.rs +++ b/examples/csv_read_parallel.rs @@ -43,7 +43,7 @@ fn parallel_read(path: &str) -> Result>>> { let child = thread::spawn(move || { let (rows, line_number) = rx_consumer.recv().unwrap(); let start = SystemTime::now(); - println!("consumer start - {}", line_number); + println!("consumer start - {line_number}"); let batch = read::deserialize_batch( &rows, &consumer_fields, diff --git a/examples/json_read.rs b/examples/json_read.rs index b674f4a9966..edea82f2755 100644 --- a/examples/json_read.rs +++ b/examples/json_read.rs @@ -26,6 +26,6 @@ fn main() -> Result<()> { let file_path = &args[1]; let batch = read_path(file_path)?; - println!("{:#?}", batch); + println!("{batch:#?}"); Ok(()) } diff --git a/examples/ndjson_read.rs b/examples/ndjson_read.rs index 93b7b64ba25..bd242d22df0 100644 --- a/examples/ndjson_read.rs +++ b/examples/ndjson_read.rs @@ -34,6 +34,6 @@ fn main() -> Result<()> { let file_path = &args[1]; let arrays = read_path(file_path)?; - println!("{:#?}", arrays); + println!("{arrays:#?}"); Ok(()) } diff --git a/examples/parquet_read.rs b/examples/parquet_read.rs index fa0a769d443..eefb2d23d6d 100644 --- a/examples/parquet_read.rs +++ b/examples/parquet_read.rs @@ -23,7 +23,7 @@ fn main() -> Result<(), Error> { // we can read the statistics of all parquet's row groups (here for each field) for field in &schema.fields { let statistics = read::statistics::deserialize(field, &metadata.row_groups)?; - println!("{:#?}", statistics); + println!("{statistics:#?}"); } // say we found that we only need to read the first two row groups, "0" and "1" diff --git a/src/array/binary/fmt.rs b/src/array/binary/fmt.rs index c2ec8737fb2..884afe0fafc 100644 --- a/src/array/binary/fmt.rs +++ b/src/array/binary/fmt.rs @@ -21,7 +21,7 @@ impl Debug for BinaryArray { } else { "BinaryArray" }; - write!(f, "{}", head)?; + write!(f, "{head}")?; write_vec(f, writer, self.validity(), self.len(), "None", false) } } diff --git a/src/array/dictionary/fmt.rs b/src/array/dictionary/fmt.rs index f5f76624001..c98ac5f5232 100644 --- a/src/array/dictionary/fmt.rs +++ b/src/array/dictionary/fmt.rs @@ -18,7 +18,7 @@ pub fn write_value( let key = array.key_value(index); get_display(values.as_ref(), null)(f, key) } else { - write!(f, "{}", null) + write!(f, "{null}") } } diff --git a/src/array/fixed_size_list/mutable.rs b/src/array/fixed_size_list/mutable.rs index 0c6c09fe3d7..d929f75e6e8 100644 --- a/src/array/fixed_size_list/mutable.rs +++ b/src/array/fixed_size_list/mutable.rs @@ -52,7 +52,7 @@ impl MutableFixedSizeListArray { assert_eq!(values.len(), 0); match data_type { DataType::FixedSizeList(..) => (), - _ => panic!("data type must be FixedSizeList (got {:?})", data_type), + _ => panic!("data type must be FixedSizeList (got {data_type:?})"), }; Self { size, diff --git a/src/array/fmt.rs b/src/array/fmt.rs index 39f4f8b1603..36cb2f4e456 100644 --- a/src/array/fmt.rs +++ b/src/array/fmt.rs @@ -13,7 +13,7 @@ pub fn get_value_display<'a, F: Write + 'a>( ) -> Box Result + 'a> { use crate::datatypes::PhysicalType::*; match array.data_type().to_physical_type() { - Null => Box::new(move |f, _| write!(f, "{}", null)), + Null => Box::new(move |f, _| write!(f, "{null}")), Boolean => Box::new(|f, index| { super::boolean::fmt::write_value(array.as_any().downcast_ref().unwrap(), index, f) }), @@ -152,7 +152,7 @@ where if val.get_bit(index) { d(f, index) } else { - write!(f, "{}", null) + write!(f, "{null}") } } else { d(f, index) diff --git a/src/array/list/fmt.rs b/src/array/list/fmt.rs index 4b10fc8f936..2f23de08412 100644 --- a/src/array/list/fmt.rs +++ b/src/array/list/fmt.rs @@ -25,7 +25,7 @@ impl Debug for ListArray { } else { "ListArray" }; - write!(f, "{}", head)?; + write!(f, "{head}")?; write_vec(f, writer, self.validity(), self.len(), "None", false) } } diff --git a/src/array/ord.rs b/src/array/ord.rs index e42c7fa0fc7..439efa1e21e 100644 --- a/src/array/ord.rs +++ b/src/array/ord.rs @@ -230,16 +230,14 @@ pub fn build_compare(left: &dyn Array, right: &dyn Array) -> Result dyn_dict!(i64, left, right), (lhs, _) => { return Err(Error::InvalidArgumentError(format!( - "Dictionaries do not support keys of type {:?}", - lhs + "Dictionaries do not support keys of type {lhs:?}" ))) } } } (lhs, _) => { return Err(Error::InvalidArgumentError(format!( - "The data type type {:?} has no natural order", - lhs + "The data type type {lhs:?} has no natural order" ))) } }) diff --git a/src/array/primitive/fmt.rs b/src/array/primitive/fmt.rs index f21b0958628..05357ef5876 100644 --- a/src/array/primitive/fmt.rs +++ b/src/array/primitive/fmt.rs @@ -94,7 +94,7 @@ pub fn get_write_value<'a, T: NativeType, F: Write>( } } Interval(IntervalUnit::YearMonth) => { - dyn_primitive!(array, i32, |x| format!("{}m", x)) + dyn_primitive!(array, i32, |x| format!("{x}m")) } Interval(IntervalUnit::DayTime) => { dyn_primitive!(array, days_ms, |x: days_ms| format!( @@ -111,10 +111,10 @@ pub fn get_write_value<'a, T: NativeType, F: Write>( x.ns() )) } - Duration(TimeUnit::Second) => dyn_primitive!(array, i64, |x| format!("{}s", x)), - Duration(TimeUnit::Millisecond) => dyn_primitive!(array, i64, |x| format!("{}ms", x)), - Duration(TimeUnit::Microsecond) => dyn_primitive!(array, i64, |x| format!("{}us", x)), - Duration(TimeUnit::Nanosecond) => dyn_primitive!(array, i64, |x| format!("{}ns", x)), + Duration(TimeUnit::Second) => dyn_primitive!(array, i64, |x| format!("{x}s")), + Duration(TimeUnit::Millisecond) => dyn_primitive!(array, i64, |x| format!("{x}ms")), + Duration(TimeUnit::Microsecond) => dyn_primitive!(array, i64, |x| format!("{x}us")), + Duration(TimeUnit::Nanosecond) => dyn_primitive!(array, i64, |x| format!("{x}ns")), Decimal(_, scale) => { // The number 999.99 has a precision of 5 and scale of 2 let scale = *scale as u32; @@ -122,7 +122,7 @@ pub fn get_write_value<'a, T: NativeType, F: Write>( let display = move |x: i128| { let base = x / factor; let decimals = (x - base * factor).abs(); - format!("{}.{}", base, decimals) + format!("{base}.{decimals}") }; dyn_primitive!(array, i128, display) } @@ -132,7 +132,7 @@ pub fn get_write_value<'a, T: NativeType, F: Write>( let display = move |x: i256| { let base = x.0 / factor; let decimals = (x.0 - base * factor).abs(); - format!("{}.{}", base, decimals) + format!("{base}.{decimals}") }; dyn_primitive!(array, i256, display) } diff --git a/src/array/specification.rs b/src/array/specification.rs index 274321be93f..0645050979f 100644 --- a/src/array/specification.rs +++ b/src/array/specification.rs @@ -126,7 +126,7 @@ pub(crate) unsafe fn check_indexes_unchecked( if invalid { let key = keys.iter().map(|k| k.as_usize()).max().unwrap(); - Err(Error::oos(format!("One of the dictionary keys is {} but it must be < than the length of the dictionary values, which is {}", key, len))) + Err(Error::oos(format!("One of the dictionary keys is {key} but it must be < than the length of the dictionary values, which is {len}"))) } else { Ok(()) } @@ -139,9 +139,9 @@ where keys.iter().try_for_each(|key| { let key: usize = (*key) .try_into() - .map_err(|_| Error::oos(format!("The dictionary key must fit in a `usize`, but {:?} does not", key)))?; + .map_err(|_| Error::oos(format!("The dictionary key must fit in a `usize`, but {key:?} does not")))?; if key >= len { - Err(Error::oos(format!("One of the dictionary keys is {} but it must be < than the length of the dictionary values, which is {}", key, len))) + Err(Error::oos(format!("One of the dictionary keys is {key} but it must be < than the length of the dictionary values, which is {len}"))) } else { Ok(()) } diff --git a/src/array/utf8/fmt.rs b/src/array/utf8/fmt.rs index 1b6868c4a0e..97576d3a716 100644 --- a/src/array/utf8/fmt.rs +++ b/src/array/utf8/fmt.rs @@ -18,7 +18,7 @@ impl Debug for Utf8Array { } else { "Utf8Array" }; - write!(f, "{}", head)?; + write!(f, "{head}")?; write_vec(f, writer, self.validity(), self.len(), "None", false) } } diff --git a/src/bitmap/utils/fmt.rs b/src/bitmap/utils/fmt.rs index 9575cf18c99..45fe9ec9ced 100644 --- a/src/bitmap/utils/fmt.rs +++ b/src/bitmap/utils/fmt.rs @@ -46,7 +46,7 @@ pub fn fmt( let number_of_bytes = remaining / 8; for byte in &bytes[..number_of_bytes] { f.write_str(", ")?; - f.write_fmt(format_args!("{:#010b}", byte))?; + f.write_fmt(format_args!("{byte:#010b}"))?; } remaining -= number_of_bytes * 8; if remaining == 0 { diff --git a/src/compute/arithmetics/decimal/add.rs b/src/compute/arithmetics/decimal/add.rs index b8775bd1a2e..9f6f529e887 100644 --- a/src/compute/arithmetics/decimal/add.rs +++ b/src/compute/arithmetics/decimal/add.rs @@ -44,8 +44,7 @@ pub fn add(lhs: &PrimitiveArray, rhs: &PrimitiveArray) -> PrimitiveA assert!( res.abs() <= max, - "Overflow in addition presented for precision {}", - precision + "Overflow in addition presented for precision {precision}" ); res diff --git a/src/compute/arithmetics/decimal/div.rs b/src/compute/arithmetics/decimal/div.rs index 01f590b9927..159c27de2b1 100644 --- a/src/compute/arithmetics/decimal/div.rs +++ b/src/compute/arithmetics/decimal/div.rs @@ -57,8 +57,7 @@ pub fn div(lhs: &PrimitiveArray, rhs: &PrimitiveArray) -> PrimitiveA assert!( res.abs() <= max, - "Overflow in multiplication presented for precision {}", - precision + "Overflow in multiplication presented for precision {precision}" ); res @@ -100,8 +99,7 @@ pub fn div_scalar(lhs: &PrimitiveArray, rhs: &PrimitiveScalar) -> Pr assert!( res.abs() <= max, - "Overflow in multiplication presented for precision {}", - precision + "Overflow in multiplication presented for precision {precision}" ); res diff --git a/src/compute/arithmetics/decimal/mul.rs b/src/compute/arithmetics/decimal/mul.rs index b279673a5de..ac702d2cb3c 100644 --- a/src/compute/arithmetics/decimal/mul.rs +++ b/src/compute/arithmetics/decimal/mul.rs @@ -58,8 +58,7 @@ pub fn mul(lhs: &PrimitiveArray, rhs: &PrimitiveArray) -> PrimitiveA assert!( res.abs() <= max, - "Overflow in multiplication presented for precision {}", - precision + "Overflow in multiplication presented for precision {precision}" ); res @@ -104,8 +103,7 @@ pub fn mul_scalar(lhs: &PrimitiveArray, rhs: &PrimitiveScalar) -> Pr assert!( res.abs() <= max, - "Overflow in multiplication presented for precision {}", - precision + "Overflow in multiplication presented for precision {precision}" ); res diff --git a/src/compute/arithmetics/decimal/sub.rs b/src/compute/arithmetics/decimal/sub.rs index 1f6adca58f9..84afd205433 100644 --- a/src/compute/arithmetics/decimal/sub.rs +++ b/src/compute/arithmetics/decimal/sub.rs @@ -42,8 +42,7 @@ pub fn sub(lhs: &PrimitiveArray, rhs: &PrimitiveArray) -> PrimitiveA assert!( res.abs() <= max, - "Overflow in subtract presented for precision {}", - precision + "Overflow in subtract presented for precision {precision}" ); res diff --git a/src/compute/cast/mod.rs b/src/compute/cast/mod.rs index d4d47380752..24f5689f38f 100644 --- a/src/compute/cast/mod.rs +++ b/src/compute/cast/mod.rs @@ -495,8 +495,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu Float32 => primitive_to_boolean_dyn::(array, to_type.clone()), Float64 => primitive_to_boolean_dyn::(array, to_type.clone()), _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, (Boolean, _) => match to_type { @@ -515,8 +514,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu Binary => boolean_to_binary_dyn::(array), LargeBinary => boolean_to_binary_dyn::(array), _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -546,8 +544,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu utf8_to_timestamp_ns_dyn::(array, tz.clone()) } _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, (LargeUtf8, _) => match to_type { @@ -574,8 +571,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu utf8_to_timestamp_ns_dyn::(array, tz.clone()) } _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -610,8 +606,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu Ok(Box::new(naive_timestamp_to_utf8::(from, *from_unit))) } _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -641,8 +636,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu Ok(Box::new(naive_timestamp_to_utf8::(from, *from_unit))) } _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -665,8 +659,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu .map(|x| x.boxed()), _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -690,8 +683,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu .map(|x| x.boxed()) } _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -707,8 +699,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu Float32 => primitive_to_binary_dyn::(array), Float64 => primitive_to_binary_dyn::(array), _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -724,8 +715,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu Float32 => primitive_to_binary_dyn::(array), Float64 => primitive_to_binary_dyn::(array), _ => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), }, @@ -919,8 +909,7 @@ pub fn cast(array: &dyn Array, to_type: &DataType, options: CastOptions) -> Resu } (_, _) => Err(Error::NotYetImplemented(format!( - "Casting from {:?} to {:?} not supported", - from_type, to_type, + "Casting from {from_type:?} to {to_type:?} not supported", ))), } } @@ -950,8 +939,7 @@ fn cast_to_dictionary( DataType::Binary => binary_to_dictionary_dyn::(array), DataType::LargeBinary => binary_to_dictionary_dyn::(array), _ => Err(Error::NotYetImplemented(format!( - "Unsupported output type for dictionary packing: {:?}", - dict_value_type + "Unsupported output type for dictionary packing: {dict_value_type:?}" ))), } } diff --git a/src/compute/contains.rs b/src/compute/contains.rs index 738a8e11e57..4fa9ea29eaa 100644 --- a/src/compute/contains.rs +++ b/src/compute/contains.rs @@ -192,8 +192,7 @@ pub fn contains(list: &dyn Array, values: &dyn Array) -> Result { (DataType::LargeList(_), DataType::Float32) => primitive!(list, values, i64, f32), (DataType::LargeList(_), DataType::Float64) => primitive!(list, values, i64, f64), _ => Err(Error::NotYetImplemented(format!( - "Contains is not supported between logical types \"{:?}\" and \"{:?}\"", - list_data_type, values_data_type + "Contains is not supported between logical types \"{list_data_type:?}\" and \"{values_data_type:?}\"" ))), } } diff --git a/src/compute/hash.rs b/src/compute/hash.rs index d5f8370d8b4..319542222e3 100644 --- a/src/compute/hash.rs +++ b/src/compute/hash.rs @@ -118,8 +118,7 @@ pub fn hash(array: &dyn Array) -> Result> { LargeUtf8 => hash_utf8::(array.as_any().downcast_ref().unwrap()), t => { return Err(Error::NotYetImplemented(format!( - "Hash not implemented for type {:?}", - t + "Hash not implemented for type {t:?}" ))) } }) diff --git a/src/compute/like.rs b/src/compute/like.rs index 5c736cd8b5f..5fa94d171e2 100644 --- a/src/compute/like.rs +++ b/src/compute/like.rs @@ -79,10 +79,9 @@ fn a_like_utf8 bool>( pattern } else { let re_pattern = replace_pattern(pattern); - let re = Regex::new(&format!("^{}$", re_pattern)).map_err(|e| { + let re = Regex::new(&format!("^{re_pattern}$")).map_err(|e| { Error::InvalidArgumentError(format!( - "Unable to build regex from LIKE pattern: {}", - e + "Unable to build regex from LIKE pattern: {e}" )) })?; map.insert(pattern, re); @@ -155,8 +154,8 @@ fn a_like_utf8_scalar bool>( Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x.ends_with(ends_with)))) } else { let re_pattern = replace_pattern(rhs); - let re = Regex::new(&format!("^{}$", re_pattern)).map_err(|e| { - Error::InvalidArgumentError(format!("Unable to build regex from LIKE pattern: {}", e)) + let re = Regex::new(&format!("^{re_pattern}$")).map_err(|e| { + Error::InvalidArgumentError(format!("Unable to build regex from LIKE pattern: {e}")) })?; Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(re.is_match(x)))) }; @@ -227,10 +226,9 @@ fn a_like_binary bool>( } else { let re_pattern = simdutf8::basic::from_utf8(pattern).unwrap(); let re_pattern = replace_pattern(re_pattern); - let re = BytesRegex::new(&format!("^{}$", re_pattern)).map_err(|e| { + let re = BytesRegex::new(&format!("^{re_pattern}$")).map_err(|e| { Error::InvalidArgumentError(format!( - "Unable to build regex from LIKE pattern: {}", - e + "Unable to build regex from LIKE pattern: {e}" )) })?; map.insert(pattern, re); @@ -290,8 +288,7 @@ fn a_like_binary_scalar bool>( let validity = lhs.validity(); let pattern = simdutf8::basic::from_utf8(rhs).map_err(|e| { Error::InvalidArgumentError(format!( - "Unable to convert the LIKE pattern to string: {}", - e + "Unable to convert the LIKE pattern to string: {e}" )) })?; @@ -310,8 +307,8 @@ fn a_like_binary_scalar bool>( Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x.ends_with(ends_with)))) } else { let re_pattern = replace_pattern(pattern); - let re = BytesRegex::new(&format!("^{}$", re_pattern)).map_err(|e| { - Error::InvalidArgumentError(format!("Unable to build regex from LIKE pattern: {}", e)) + let re = BytesRegex::new(&format!("^{re_pattern}$")).map_err(|e| { + Error::InvalidArgumentError(format!("Unable to build regex from LIKE pattern: {e}")) })?; Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(re.is_match(x)))) }; diff --git a/src/compute/regex_match.rs b/src/compute/regex_match.rs index 371eb073e46..57b23721480 100644 --- a/src/compute/regex_match.rs +++ b/src/compute/regex_match.rs @@ -35,8 +35,7 @@ pub fn regex_match(values: &Utf8Array, regex: &Utf8Array) -> Re } else { let re = Regex::new(regex).map_err(|e| { Error::InvalidArgumentError(format!( - "Unable to build regex from LIKE pattern: {}", - e + "Unable to build regex from LIKE pattern: {e}" )) })?; map.insert(regex, re); @@ -63,7 +62,7 @@ pub fn regex_match(values: &Utf8Array, regex: &Utf8Array) -> Re /// ``` pub fn regex_match_scalar(values: &Utf8Array, regex: &str) -> Result { let regex = Regex::new(regex) - .map_err(|e| Error::InvalidArgumentError(format!("Unable to compile regex: {}", e)))?; + .map_err(|e| Error::InvalidArgumentError(format!("Unable to compile regex: {e}")))?; Ok(unary_utf8_boolean(values, |x| regex.is_match(x))) } diff --git a/src/compute/sort/mod.rs b/src/compute/sort/mod.rs index 5394e370280..92272d057c7 100644 --- a/src/compute/sort/mod.rs +++ b/src/compute/sort/mod.rs @@ -165,8 +165,7 @@ pub fn sort_to_indices( DataType::UInt32 => Ok(sort_list::(values, v, n, options, limit)), DataType::UInt64 => Ok(sort_list::(values, v, n, options, limit)), t => Err(Error::NotYetImplemented(format!( - "Sort not supported for list type {:?}", - t + "Sort not supported for list type {t:?}" ))), } } @@ -182,8 +181,7 @@ pub fn sort_to_indices( DataType::UInt32 => Ok(sort_list::(values, v, n, options, limit)), DataType::UInt64 => Ok(sort_list::(values, v, n, options, limit)), t => Err(Error::NotYetImplemented(format!( - "Sort not supported for list type {:?}", - t + "Sort not supported for list type {t:?}" ))), } } @@ -199,8 +197,7 @@ pub fn sort_to_indices( DataType::UInt32 => Ok(sort_list::(values, v, n, options, limit)), DataType::UInt64 => Ok(sort_list::(values, v, n, options, limit)), t => Err(Error::NotYetImplemented(format!( - "Sort not supported for list type {:?}", - t + "Sort not supported for list type {t:?}" ))), } } @@ -208,13 +205,11 @@ pub fn sort_to_indices( DataType::Utf8 => Ok(sort_dict::(values, key_type, options, limit)), DataType::LargeUtf8 => Ok(sort_dict::(values, key_type, options, limit)), t => Err(Error::NotYetImplemented(format!( - "Sort not supported for dictionary type with keys {:?}", - t + "Sort not supported for dictionary type with keys {t:?}" ))), }, t => Err(Error::NotYetImplemented(format!( - "Sort not supported for data type {:?}", - t + "Sort not supported for data type {t:?}" ))), } } diff --git a/src/compute/sort/row/dictionary.rs b/src/compute/sort/row/dictionary.rs index e97a71aba7e..fc7b80b30af 100644 --- a/src/compute/sort/row/dictionary.rs +++ b/src/compute/sort/row/dictionary.rs @@ -80,8 +80,7 @@ pub fn compute_dictionary_mapping( } t => { return Err(Error::NotYetImplemented(format!( - "dictionary value {:?} is not supported", - t + "dictionary value {t:?} is not supported" ))) } }) diff --git a/src/compute/sort/row/mod.rs b/src/compute/sort/row/mod.rs index e342537d68c..2388a6c8680 100644 --- a/src/compute/sort/row/mod.rs +++ b/src/compute/sort/row/mod.rs @@ -509,8 +509,7 @@ fn new_empty_rows( }), t => { return Err(Error::NotYetImplemented(format!( - "not yet implemented: {:?}", - t + "not yet implemented: {t:?}" ))) } } diff --git a/src/compute/take/boolean.rs b/src/compute/take/boolean.rs index 76ef8c67b32..8a3b7c859b9 100644 --- a/src/compute/take/boolean.rs +++ b/src/compute/take/boolean.rs @@ -48,7 +48,7 @@ fn take_indices_validity( if !validity.get_bit(i) { false } else { - panic!("Out-of-bounds index {}", index) + panic!("Out-of-bounds index {index}") } } } diff --git a/src/compute/take/primitive.rs b/src/compute/take/primitive.rs index bd033680b63..3708fe02478 100644 --- a/src/compute/take/primitive.rs +++ b/src/compute/take/primitive.rs @@ -60,7 +60,7 @@ fn take_indices_validity( if !validity.get_bit(i) { T::default() } else { - panic!("Out-of-bounds index {}", index) + panic!("Out-of-bounds index {index}") } } } diff --git a/src/error.rs b/src/error.rs index 52a8cd9062b..e5e55b50c63 100644 --- a/src/error.rs +++ b/src/error.rs @@ -77,18 +77,18 @@ impl Display for Error { Error::External(message, source) => { write!(f, "External error{}: {}", message, &source) } - Error::Io(desc) => write!(f, "Io error: {}", desc), + Error::Io(desc) => write!(f, "Io error: {desc}"), Error::InvalidArgumentError(desc) => { - write!(f, "Invalid argument error: {}", desc) + write!(f, "Invalid argument error: {desc}") } Error::ExternalFormat(desc) => { - write!(f, "External format error: {}", desc) + write!(f, "External format error: {desc}") } Error::Overflow => { write!(f, "Operation overflew the backing container.") } Error::OutOfSpec(message) => { - write!(f, "{}", message) + write!(f, "{message}") } } } diff --git a/src/ffi/schema.rs b/src/ffi/schema.rs index 143a2f477ec..2751583ef1b 100644 --- a/src/ffi/schema.rs +++ b/src/ffi/schema.rs @@ -374,8 +374,7 @@ unsafe fn to_data_type(schema: &ArrowSchema) -> Result { } _ => { return Err(Error::OutOfSpec(format!( - "The datatype \"{}\" is still not supported in Rust implementation", - other + "The datatype \"{other}\" is still not supported in Rust implementation", ))); } } @@ -437,16 +436,16 @@ fn to_format(data_type: &DataType) -> String { tz.as_ref().map(|x| x.as_ref()).unwrap_or("") ) } - DataType::Decimal(precision, scale) => format!("d:{},{}", precision, scale), - DataType::Decimal256(precision, scale) => format!("d:{},{},256", precision, scale), + DataType::Decimal(precision, scale) => format!("d:{precision},{scale}"), + DataType::Decimal256(precision, scale) => format!("d:{precision},{scale},256"), DataType::List(_) => "+l".to_string(), DataType::LargeList(_) => "+L".to_string(), DataType::Struct(_) => "+s".to_string(), - DataType::FixedSizeBinary(size) => format!("w:{}", size), - DataType::FixedSizeList(_, size) => format!("+w:{}", size), + DataType::FixedSizeBinary(size) => format!("w:{size}"), + DataType::FixedSizeList(_, size) => format!("+w:{size}"), DataType::Union(f, ids, mode) => { let sparsness = if mode.is_sparse() { 's' } else { 'd' }; - let mut r = format!("+u{}:", sparsness); + let mut r = format!("+u{sparsness}:"); let ids = if let Some(ids) = ids { ids.iter() .fold(String::new(), |a, b| a + &b.to_string() + ",") @@ -473,8 +472,7 @@ pub(super) fn get_child(data_type: &DataType, index: usize) -> Result (index, DataType::Union(fields, _, _)) => Ok(fields[index].data_type().clone()), (index, DataType::Extension(_, subtype, _)) => get_child(subtype, index), (child, data_type) => Err(Error::OutOfSpec(format!( - "Requested child {} to type {:?} that has no such child", - child, data_type + "Requested child {child} to type {data_type:?} that has no such child", ))), } } diff --git a/src/io/avro/read/deserialize.rs b/src/io/avro/read/deserialize.rs index 6d95fe19145..d2de2a7ac4e 100644 --- a/src/io/avro/read/deserialize.rs +++ b/src/io/avro/read/deserialize.rs @@ -65,8 +65,7 @@ fn make_mutable( } other => { return Err(Error::NotYetImplemented(format!( - "Deserializing type {:#?} is still not implemented", - other + "Deserializing type {other:#?} is still not implemented" ))) } }, diff --git a/src/io/avro/read/schema.rs b/src/io/avro/read/schema.rs index b45fc95c0ea..3a920286c03 100644 --- a/src/io/avro/read/schema.rs +++ b/src/io/avro/read/schema.rs @@ -95,8 +95,7 @@ fn schema_to_field(schema: &AvroSchema, name: Option<&str>, props: Metadata) -> schema_to_field(schema, None, Metadata::default())?.data_type } else { return Err(Error::NotYetImplemented(format!( - "Can't read avro union {:?}", - schema + "Can't read avro union {schema:?}" ))); } } else { diff --git a/src/io/avro/write/mod.rs b/src/io/avro/write/mod.rs index f821f0dd1eb..6448782bb44 100644 --- a/src/io/avro/write/mod.rs +++ b/src/io/avro/write/mod.rs @@ -10,7 +10,7 @@ pub use serialize::{can_serialize, new_serializer, BoxSerializer}; /// # Panics /// Panics iff the number of items in any of the serializers is not equal to the number of rows /// declared in the `block`. -pub fn serialize<'a>(serializers: &mut [BoxSerializer<'a>], block: &mut Block) { +pub fn serialize(serializers: &mut [BoxSerializer], block: &mut Block) { let Block { data, number_of_rows, diff --git a/src/io/avro/write/schema.rs b/src/io/avro/write/schema.rs index b0904ca89c1..ee9dde39cba 100644 --- a/src/io/avro/write/schema.rs +++ b/src/io/avro/write/schema.rs @@ -45,7 +45,7 @@ fn type_to_schema( fn _get_field_name(name_counter: &mut i32) -> String { *name_counter += 1; - format!("r{}", name_counter) + format!("r{name_counter}") } fn _type_to_schema(data_type: &DataType, name_counter: &mut i32) -> Result { @@ -88,8 +88,7 @@ fn _type_to_schema(data_type: &DataType, name_counter: &mut i32) -> Result AvroSchema::Bytes(Some(BytesLogical::Decimal(*p, *s))), other => { return Err(Error::NotYetImplemented(format!( - "write {:?} to avro", - other + "write {other:?} to avro" ))) } }) diff --git a/src/io/csv/read_utils.rs b/src/io/csv/read_utils.rs index 278dd32cb21..2212ac45acc 100644 --- a/src/io/csv/read_utils.rs +++ b/src/io/csv/read_utils.rs @@ -235,8 +235,7 @@ pub(crate) fn deserialize_column( LargeBinary => deserialize_binary::(rows, column), other => { return Err(Error::NotYetImplemented(format!( - "Deserializing type \"{:?}\" is not implemented", - other + "Deserializing type \"{other:?}\" is not implemented" ))) } }) diff --git a/src/io/csv/utils.rs b/src/io/csv/utils.rs index 436c7d192f3..fa8c01f43d7 100644 --- a/src/io/csv/utils.rs +++ b/src/io/csv/utils.rs @@ -34,7 +34,7 @@ fn is_datetime(string: &str) -> Option { parsed.offset.map(|x| { let hours = x / 60 / 60; let minutes = x / 60 - hours * 60; - format!("{:03}:{:02}", hours, minutes) + format!("{hours:03}:{minutes:02}") }) } else { None diff --git a/src/io/csv/write/serialize.rs b/src/io/csv/write/serialize.rs index 46addc378f0..7543ef16d92 100644 --- a/src/io/csv/write/serialize.rs +++ b/src/io/csv/write/serialize.rs @@ -127,7 +127,7 @@ fn timestamp_with_tz_default<'a>( move |x, buf| { if let Some(x) = x { let dt = temporal_conversions::timestamp_to_datetime(*x, time_unit, &timezone); - let _ = write!(StringWrap(buf), "{}", dt); + let _ = write!(StringWrap(buf), "{dt}"); } }, vec![], @@ -141,7 +141,7 @@ fn timestamp_with_tz_default<'a>( if let Some(x) = x { let dt = temporal_conversions::timestamp_to_datetime(*x, time_unit, &timezone); - let _ = write!(StringWrap(buf), "{}", dt); + let _ = write!(StringWrap(buf), "{dt}"); } }, vec![], @@ -171,7 +171,7 @@ fn timestamp_with_tz_with_format<'a>( if let Some(x) = x { let dt = temporal_conversions::timestamp_to_datetime(*x, time_unit, &timezone) .format(format); - let _ = write!(StringWrap(buf), "{}", dt); + let _ = write!(StringWrap(buf), "{dt}"); } }, vec![], @@ -186,7 +186,7 @@ fn timestamp_with_tz_with_format<'a>( let dt = temporal_conversions::timestamp_to_datetime(*x, time_unit, &timezone) .format(format); - let _ = write!(StringWrap(buf), "{}", dt); + let _ = write!(StringWrap(buf), "{dt}"); } }, vec![], @@ -462,7 +462,7 @@ pub fn new_serializer<'a>( panic!("only dictionary with string values are supported by csv writer") } }, - dt => panic!("data type: {:?} not supported by csv writer", dt), + dt => panic!("data type: {dt:?} not supported by csv writer"), }) } diff --git a/src/io/flight/mod.rs b/src/io/flight/mod.rs index 3c0dc0a919f..6291f86e610 100644 --- a/src/io/flight/mod.rs +++ b/src/io/flight/mod.rs @@ -124,7 +124,7 @@ pub fn deserialize_batch( ) -> Result>> { // check that the data_header is a record batch message let message = arrow_format::ipc::MessageRef::read_as_root(&data.data_header) - .map_err(|err| Error::OutOfSpec(format!("Unable to get root as message: {:?}", err)))?; + .map_err(|err| Error::OutOfSpec(format!("Unable to get root as message: {err:?}")))?; let length = data.data_body.len(); let mut reader = std::io::Cursor::new(&data.data_body); @@ -242,8 +242,7 @@ pub fn deserialize_message( Ok(None) } t => Err(Error::nyi(format!( - "Reading types other than record batches not yet supported, unable to read {:?}", - t + "Reading types other than record batches not yet supported, unable to read {t:?}" ))), } } diff --git a/src/io/ipc/read/array/binary.rs b/src/io/ipc/read/array/binary.rs index 68c5b40d078..15361da0968 100644 --- a/src/io/ipc/read/array/binary.rs +++ b/src/io/ipc/read/array/binary.rs @@ -24,8 +24,7 @@ pub fn read_binary( ) -> Result> { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/boolean.rs b/src/io/ipc/read/array/boolean.rs index f53c0afd99b..dbe40b3194e 100644 --- a/src/io/ipc/read/array/boolean.rs +++ b/src/io/ipc/read/array/boolean.rs @@ -22,8 +22,7 @@ pub fn read_boolean( ) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/dictionary.rs b/src/io/ipc/read/array/dictionary.rs index f3d92f65a2f..e92453528ed 100644 --- a/src/io/ipc/read/array/dictionary.rs +++ b/src/io/ipc/read/array/dictionary.rs @@ -37,8 +37,7 @@ where .ok_or_else(|| { let valid_ids = dictionaries.keys().collect::>(); Error::OutOfSpec(format!( - "Dictionary id {} not found. Valid ids: {:?}", - id, valid_ids + "Dictionary id {id} not found. Valid ids: {valid_ids:?}" )) })? .clone(); diff --git a/src/io/ipc/read/array/fixed_size_binary.rs b/src/io/ipc/read/array/fixed_size_binary.rs index 72e0bd8f5b9..79ab0586fae 100644 --- a/src/io/ipc/read/array/fixed_size_binary.rs +++ b/src/io/ipc/read/array/fixed_size_binary.rs @@ -22,8 +22,7 @@ pub fn read_fixed_size_binary( ) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/fixed_size_list.rs b/src/io/ipc/read/array/fixed_size_list.rs index 94c1c7662c4..1f5d919c3cd 100644 --- a/src/io/ipc/read/array/fixed_size_list.rs +++ b/src/io/ipc/read/array/fixed_size_list.rs @@ -27,8 +27,7 @@ pub fn read_fixed_size_list( ) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/list.rs b/src/io/ipc/read/array/list.rs index 1b45b10730d..b6a9ef26155 100644 --- a/src/io/ipc/read/array/list.rs +++ b/src/io/ipc/read/array/list.rs @@ -33,8 +33,7 @@ where { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/map.rs b/src/io/ipc/read/array/map.rs index 4acec42ef6b..b98678e0524 100644 --- a/src/io/ipc/read/array/map.rs +++ b/src/io/ipc/read/array/map.rs @@ -28,8 +28,7 @@ pub fn read_map( ) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/null.rs b/src/io/ipc/read/array/null.rs index 5cf5184c055..eee14608d85 100644 --- a/src/io/ipc/read/array/null.rs +++ b/src/io/ipc/read/array/null.rs @@ -11,8 +11,7 @@ use super::super::{Node, OutOfSpecKind}; pub fn read_null(field_nodes: &mut VecDeque, data_type: DataType) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/primitive.rs b/src/io/ipc/read/array/primitive.rs index bba155f78ea..0815d2ae7a2 100644 --- a/src/io/ipc/read/array/primitive.rs +++ b/src/io/ipc/read/array/primitive.rs @@ -25,8 +25,7 @@ where { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/struct_.rs b/src/io/ipc/read/array/struct_.rs index 77f5d74bedf..06d0f55ad3d 100644 --- a/src/io/ipc/read/array/struct_.rs +++ b/src/io/ipc/read/array/struct_.rs @@ -27,8 +27,7 @@ pub fn read_struct( ) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/union.rs b/src/io/ipc/read/array/union.rs index 627d912b443..569014797a2 100644 --- a/src/io/ipc/read/array/union.rs +++ b/src/io/ipc/read/array/union.rs @@ -28,8 +28,7 @@ pub fn read_union( ) -> Result { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/array/utf8.rs b/src/io/ipc/read/array/utf8.rs index 398184e3e55..741b2b91585 100644 --- a/src/io/ipc/read/array/utf8.rs +++ b/src/io/ipc/read/array/utf8.rs @@ -24,8 +24,7 @@ pub fn read_utf8( ) -> Result> { let field_node = field_nodes.pop_front().ok_or_else(|| { Error::oos(format!( - "IPC: unable to fetch the field for {:?}. The file or stream is corrupted.", - data_type + "IPC: unable to fetch the field for {data_type:?}. The file or stream is corrupted." )) })?; diff --git a/src/io/ipc/read/error.rs b/src/io/ipc/read/error.rs index 0fdd6a01c94..747f1a5672e 100644 --- a/src/io/ipc/read/error.rs +++ b/src/io/ipc/read/error.rs @@ -99,7 +99,7 @@ pub enum OutOfSpecKind { impl From for Error { fn from(kind: OutOfSpecKind) -> Self { - Error::OutOfSpec(format!("{:?}", kind)) + Error::OutOfSpec(format!("{kind:?}")) } } diff --git a/src/io/ipc/read/file.rs b/src/io/ipc/read/file.rs index ad8dc348110..341cdfeba65 100644 --- a/src/io/ipc/read/file.rs +++ b/src/io/ipc/read/file.rs @@ -213,7 +213,7 @@ pub(super) fn deserialize_footer(footer_data: &[u8], size: u64) -> Result(reader: &mut R) -> Result { // check if header contain the correct magic bytes let mut magic_buffer: [u8; 6] = [0; 6]; - let start = reader.seek(SeekFrom::Current(0))?; + let start = reader.stream_position()?; reader.read_exact(&mut magic_buffer)?; if magic_buffer != ARROW_MAGIC { return Err(Error::from(OutOfSpecKind::InvalidHeader)); diff --git a/src/io/ipc/read/schema.rs b/src/io/ipc/read/schema.rs index 5a9646ea370..7ec87eaa334 100644 --- a/src/io/ipc/read/schema.rs +++ b/src/io/ipc/read/schema.rs @@ -96,8 +96,7 @@ fn deserialize_time(time: TimeRef) -> Result<(DataType, IpcField)> { (64, TimeUnit::Nanosecond) => DataType::Time64(TimeUnit::Nanosecond), (bits, precision) => { return Err(Error::nyi(format!( - "Time type with bit width of {} and unit of {:?}", - bits, precision + "Time type with bit width of {bits} and unit of {precision:?}" ))) } }; @@ -360,7 +359,7 @@ fn get_data_type( /// Deserialize an flatbuffers-encoded Schema message into [`Schema`] and [`IpcSchema`]. pub fn deserialize_schema(message: &[u8]) -> Result<(Schema, IpcSchema)> { let message = arrow_format::ipc::MessageRef::read_as_root(message) - .map_err(|err| Error::oos(format!("Unable deserialize message: {:?}", err)))?; + .map_err(|err| Error::oos(format!("Unable deserialize message: {err:?}")))?; let schema = match message .header()? @@ -413,7 +412,7 @@ pub(super) fn fb_to_schema(schema: arrow_format::ipc::SchemaRef) -> Result<(Sche pub(super) fn deserialize_stream_metadata(meta: &[u8]) -> Result { let message = arrow_format::ipc::MessageRef::read_as_root(meta) - .map_err(|err| Error::OutOfSpec(format!("Unable to get root as message: {:?}", err)))?; + .map_err(|err| Error::OutOfSpec(format!("Unable to get root as message: {err:?}")))?; let version = message.version()?; // message header is a Schema, so read it let header = message diff --git a/src/io/json/read/deserialize.rs b/src/io/json/read/deserialize.rs index 73eac81d4f9..cad89b22867 100644 --- a/src/io/json/read/deserialize.rs +++ b/src/io/json/read/deserialize.rs @@ -657,7 +657,7 @@ pub fn deserialize_records(json: &Value, schema: &Schema) -> Result { for (key, value) in record.iter() { let arr = results.get_mut(key).ok_or_else(|| { - Error::ExternalFormat(format!("unexpected key: '{}'", key)) + Error::ExternalFormat(format!("unexpected key: '{key}'")) })?; deserialize_into(arr, &[value]); } diff --git a/src/io/json/read/infer_schema.rs b/src/io/json/read/infer_schema.rs index 1bab0251ac9..f098bf80d3b 100644 --- a/src/io/json/read/infer_schema.rs +++ b/src/io/json/read/infer_schema.rs @@ -39,7 +39,7 @@ pub fn infer_records_schema(json: &Value) -> Result { Ok(Field { name: name.clone(), data_type: DataType::List(Box::new(Field { - name: format!("{}-records", name), + name: format!("{name}-records"), data_type, is_nullable: true, metadata: Metadata::default(), diff --git a/src/io/json/write/serialize.rs b/src/io/json/write/serialize.rs index ec1b0d5ee49..2f5da0e63e2 100644 --- a/src/io/json/write/serialize.rs +++ b/src/io/json/write/serialize.rs @@ -204,7 +204,7 @@ where move |x, buf| { if let Some(x) = x { let nd = convert(*x); - write!(buf, "\"{}\"", nd).unwrap(); + write!(buf, "\"{nd}\"").unwrap(); } else { buf.extend_from_slice(b"null") } @@ -225,7 +225,7 @@ where move |x, buf| { if let Some(x) = x { let ndt = convert(*x); - write!(buf, "\"{}\"", ndt).unwrap(); + write!(buf, "\"{ndt}\"").unwrap(); } else { buf.extend_from_slice(b"null") } diff --git a/src/io/json_integration/read/array.rs b/src/io/json_integration/read/array.rs index bca82eafde4..c658a2a0cf4 100644 --- a/src/io/json_integration/read/array.rs +++ b/src/io/json_integration/read/array.rs @@ -261,7 +261,7 @@ fn to_dictionary( let dict_id = field.dictionary_id.unwrap(); let dictionary = dictionaries .get(&dict_id) - .ok_or_else(|| Error::OutOfSpec(format!("Unable to find any dictionary id {}", dict_id)))?; + .ok_or_else(|| Error::OutOfSpec(format!("Unable to find any dictionary id {dict_id}")))?; let keys = to_primitive(json_col, K::PRIMITIVE.into()); diff --git a/src/io/json_integration/read/schema.rs b/src/io/json_integration/read/schema.rs index 06e2ecbaf41..6a54dafc2b1 100644 --- a/src/io/json_integration/read/schema.rs +++ b/src/io/json_integration/read/schema.rs @@ -24,7 +24,7 @@ fn to_time_unit(item: Option<&Value>) -> Result { fn to_int(item: &Value) -> Result { Ok(match item.get("isSigned") { Some(&Value::Bool(true)) => match item.get("bitWidth") { - Some(&Value::Number(ref n)) => match n.as_u64() { + Some(Value::Number(n)) => match n.as_u64() { Some(8) => IntegerType::Int8, Some(16) => IntegerType::Int16, Some(32) => IntegerType::Int32, @@ -42,7 +42,7 @@ fn to_int(item: &Value) -> Result { } }, Some(&Value::Bool(false)) => match item.get("bitWidth") { - Some(&Value::Number(ref n)) => match n.as_u64() { + Some(Value::Number(n)) => match n.as_u64() { Some(8) => IntegerType::UInt8, Some(16) => IntegerType::UInt16, Some(32) => IntegerType::UInt32, @@ -126,8 +126,7 @@ fn read_metadata(metadata: &Value) -> Result { res.insert(k.clone(), str_value.to_string().clone()); } else { return Err(Error::OutOfSpec(format!( - "Field 'metadata' contains non-string value for key {}", - k + "Field 'metadata' contains non-string value for key {k}" ))); } } @@ -282,8 +281,7 @@ fn to_data_type(item: &Value, mut children: Vec) -> Result { } other => { return Err(Error::NotYetImplemented(format!( - "invalid json value type \"{}\"", - other + "invalid json value type \"{other}\"" ))) } }) @@ -338,7 +336,7 @@ fn deserialize_field(value: &Value) -> Result { }; let name = match map.get("name") { - Some(&Value::String(ref name)) => name.to_string(), + Some(Value::String(name)) => name.to_string(), _ => { return Err(Error::OutOfSpec( "Field missing 'name' attribute".to_string(), diff --git a/src/io/ndjson/read/file.rs b/src/io/ndjson/read/file.rs index 6ed5497489a..98ee328115f 100644 --- a/src/io/ndjson/read/file.rs +++ b/src/io/ndjson/read/file.rs @@ -22,7 +22,7 @@ fn read_rows(reader: &mut R, rows: &mut [String], limit: usize) -> R row.clear(); let _ = reader .read_line(row) - .map_err(|e| Error::External(format!(" at line {}", row_number), Box::new(e)))?; + .map_err(|e| Error::External(format!(" at line {row_number}"), Box::new(e)))?; if row.is_empty() { break; } diff --git a/src/io/orc/mod.rs b/src/io/orc/mod.rs index 6d1ac5953e3..9b982a3ca76 100644 --- a/src/io/orc/mod.rs +++ b/src/io/orc/mod.rs @@ -7,6 +7,6 @@ use crate::error::Error; impl From for Error { fn from(error: format::error::Error) -> Self { - Error::ExternalFormat(format!("{:?}", error)) + Error::ExternalFormat(format!("{error:?}")) } } diff --git a/src/io/parquet/read/deserialize/dictionary/mod.rs b/src/io/parquet/read/deserialize/dictionary/mod.rs index 43fcaa8ab21..7ed3cb6f6f6 100644 --- a/src/io/parquet/read/deserialize/dictionary/mod.rs +++ b/src/io/parquet/read/deserialize/dictionary/mod.rs @@ -239,8 +239,8 @@ fn finish_key(values: Vec, validity: MutableBitmap) -> Prim } #[inline] -pub(super) fn next_dict<'a, K: DictionaryKey, I: Pages, F: Fn(&DictPage) -> Box>( - iter: &'a mut I, +pub(super) fn next_dict Box>( + iter: &mut I, items: &mut VecDeque<(Vec, MutableBitmap)>, dict: &mut Option>, data_type: DataType, diff --git a/src/io/parquet/read/deserialize/dictionary/nested.rs b/src/io/parquet/read/deserialize/dictionary/nested.rs index 89b8701231f..a1dec1a28d4 100644 --- a/src/io/parquet/read/deserialize/dictionary/nested.rs +++ b/src/io/parquet/read/deserialize/dictionary/nested.rs @@ -145,8 +145,8 @@ impl<'a, K: DictionaryKey> NestedDecoder<'a> for DictionaryDecoder { } #[allow(clippy::too_many_arguments)] -pub fn next_dict<'a, K: DictionaryKey, I: Pages, F: Fn(&DictPage) -> Box>( - iter: &'a mut I, +pub fn next_dict Box>( + iter: &mut I, items: &mut VecDeque<(NestedState, (Vec, MutableBitmap))>, remaining: &mut usize, init: &[InitNested], diff --git a/src/io/parquet/read/deserialize/nested.rs b/src/io/parquet/read/deserialize/nested.rs index 065190fbb7e..4efa7adbcca 100644 --- a/src/io/parquet/read/deserialize/nested.rs +++ b/src/io/parquet/read/deserialize/nested.rs @@ -428,8 +428,7 @@ fn dict_read<'a, K: DictionaryKey, I: 'a + Pages>( */ other => { return Err(Error::nyi(format!( - "Reading nested dictionaries of type {:?}", - other + "Reading nested dictionaries of type {other:?}" ))) } }) diff --git a/src/io/parquet/read/deserialize/simple.rs b/src/io/parquet/read/deserialize/simple.rs index 8b8ad6db452..cacb518bb3e 100644 --- a/src/io/parquet/read/deserialize/simple.rs +++ b/src/io/parquet/read/deserialize/simple.rs @@ -103,8 +103,7 @@ pub fn page_iter_to_arrays<'a, I: Pages + 'a>( ))), other => { return Err(Error::NotYetImplemented(format!( - "Reading uin32 from {:?}-encoded parquet still not implemented", - other + "Reading uin32 from {other:?}-encoded parquet still not implemented" ))) } }, @@ -216,8 +215,7 @@ pub fn page_iter_to_arrays<'a, I: Pages + 'a>( ))), PhysicalType::FixedLenByteArray(n) if *n > 16 => { return Err(Error::NotYetImplemented(format!( - "Can't decode Decimal128 type from Fixed Size Byte Array of len {:?}", - n + "Can't decode Decimal128 type from Fixed Size Byte Array of len {n:?}" ))) } PhysicalType::FixedLenByteArray(n) => { @@ -301,8 +299,7 @@ pub fn page_iter_to_arrays<'a, I: Pages + 'a>( other => { return Err(Error::NotYetImplemented(format!( - "Reading {:?} from parquet still not implemented", - other + "Reading {other:?} from parquet still not implemented" ))) } }) @@ -545,8 +542,7 @@ fn dict_read<'a, K: DictionaryKey, I: Pages + 'a>( )), other => { return Err(Error::nyi(format!( - "Reading dictionaries of type {:?}", - other + "Reading dictionaries of type {other:?}" ))) } }) diff --git a/src/io/parquet/read/deserialize/utils.rs b/src/io/parquet/read/deserialize/utils.rs index 71bce24c586..9c4855813f6 100644 --- a/src/io/parquet/read/deserialize/utils.rs +++ b/src/io/parquet/read/deserialize/utils.rs @@ -289,9 +289,9 @@ impl<'a> PageValidity<'a> for OptionalPageValidity<'a> { } /// Extends a [`Pushable`] from an iterator of non-null values and an hybrid-rle decoder -pub(super) fn extend_from_decoder<'a, T: Default, P: Pushable, I: Iterator>( +pub(super) fn extend_from_decoder, I: Iterator>( validity: &mut MutableBitmap, - page_validity: &mut dyn PageValidity<'a>, + page_validity: &mut dyn PageValidity, limit: Option, pushable: &mut P, mut values_iter: I, diff --git a/src/io/parquet/read/schema/convert.rs b/src/io/parquet/read/schema/convert.rs index 5f23dc71dd6..821d5107649 100644 --- a/src/io/parquet/read/schema/convert.rs +++ b/src/io/parquet/read/schema/convert.rs @@ -299,7 +299,7 @@ fn to_list(fields: &[ParquetType], parent_name: &str) -> Option { ParquetType::GroupType { fields, .. } => { if fields.len() == 1 && item.name() != "array" - && item.name() != format!("{}_tuple", parent_name) + && item.name() != format!("{parent_name}_tuple") { // extract the repetition field let nested_item = fields.first().unwrap(); diff --git a/src/io/parquet/read/schema/metadata.rs b/src/io/parquet/read/schema/metadata.rs index 469d39bd261..2595083f44e 100644 --- a/src/io/parquet/read/schema/metadata.rs +++ b/src/io/parquet/read/schema/metadata.rs @@ -31,8 +31,7 @@ fn get_arrow_schema_from_metadata(encoded_meta: &str) -> Result { Err(err) => { // The C++ implementation returns an error if the schema can't be parsed. Err(Error::InvalidArgumentError(format!( - "Unable to decode the encoded schema stored in {}, {:?}", - ARROW_SCHEMA_META_KEY, err + "Unable to decode the encoded schema stored in {ARROW_SCHEMA_META_KEY}, {err:?}" ))) } } diff --git a/src/io/parquet/read/statistics/mod.rs b/src/io/parquet/read/statistics/mod.rs index 599fa0102f1..44feca4c2a9 100644 --- a/src/io/parquet/read/statistics/mod.rs +++ b/src/io/parquet/read/statistics/mod.rs @@ -194,8 +194,7 @@ fn make_mutable(data_type: &DataType, capacity: usize) -> Result { return Err(Error::NotYetImplemented(format!( - "Deserializing parquet stats from {:?} is still not implemented", - other + "Deserializing parquet stats from {other:?} is still not implemented" ))) } }) @@ -451,8 +450,7 @@ fn push( ParquetPhysicalType::Int64 => primitive::push(from, min, max, |x: i64| Ok(x as u32)), ParquetPhysicalType::Int32 => primitive::push(from, min, max, |x: i32| Ok(x as u32)), other => Err(Error::NotYetImplemented(format!( - "Can't decode UInt32 type from parquet type {:?}", - other + "Can't decode UInt32 type from parquet type {other:?}" ))), }, Int32 => primitive::push::(from, min, max, Ok), @@ -505,8 +503,7 @@ fn push( ParquetPhysicalType::Int64 => primitive::push(from, min, max, |x: i64| Ok(x as i128)), ParquetPhysicalType::FixedLenByteArray(n) if *n > 16 => { Err(Error::NotYetImplemented(format!( - "Can't decode Decimal128 type from Fixed Size Byte Array of len {:?}", - n + "Can't decode Decimal128 type from Fixed Size Byte Array of len {n:?}" ))) } ParquetPhysicalType::FixedLenByteArray(n) => fixlen::push_i128(from, *n, min, max), diff --git a/src/io/parquet/write/dictionary.rs b/src/io/parquet/write/dictionary.rs index 01a5f8412fa..38f4e2113cf 100644 --- a/src/io/parquet/write/dictionary.rs +++ b/src/io/parquet/write/dictionary.rs @@ -229,8 +229,7 @@ pub fn array_to_pages( } other => { return Err(Error::NotYetImplemented(format!( - "Writing dictionary arrays to parquet only support data type {:?}", - other + "Writing dictionary arrays to parquet only support data type {other:?}" ))) } }; diff --git a/src/io/parquet/write/mod.rs b/src/io/parquet/write/mod.rs index 150211f7c22..5bb0bd0f619 100644 --- a/src/io/parquet/write/mod.rs +++ b/src/io/parquet/write/mod.rs @@ -312,8 +312,7 @@ pub fn array_to_page_simple( let data_type = array.data_type(); if !can_encode(data_type, encoding) { return Err(Error::InvalidArgumentError(format!( - "The datatype {:?} cannot be encoded by {:?}", - data_type, encoding + "The datatype {data_type:?} cannot be encoded by {encoding:?}" ))); } @@ -527,8 +526,7 @@ pub fn array_to_page_simple( } } other => Err(Error::NotYetImplemented(format!( - "Writing parquet pages for data type {:?}", - other + "Writing parquet pages for data type {other:?}" ))), } .map(Page::Data) @@ -608,8 +606,7 @@ fn array_to_page_nested( primitive::nested_array_to_page::(array, options, type_, nested) } other => Err(Error::NotYetImplemented(format!( - "Writing nested parquet pages for data type {:?}", - other + "Writing nested parquet pages for data type {other:?}" ))), } .map(Page::Data) diff --git a/src/io/parquet/write/schema.rs b/src/io/parquet/write/schema.rs index bf3100bdcf0..248397d2414 100644 --- a/src/io/parquet/write/schema.rs +++ b/src/io/parquet/write/schema.rs @@ -320,8 +320,7 @@ pub fn to_parquet_type(field: &Field) -> Result { )) } other => Err(Error::NotYetImplemented(format!( - "Writing the data type {:?} is not yet implemented", - other + "Writing the data type {other:?} is not yet implemented" ))), } } diff --git a/src/temporal_conversions.rs b/src/temporal_conversions.rs index 8eae7213fc8..fcf2c0a746c 100644 --- a/src/temporal_conversions.rs +++ b/src/temporal_conversions.rs @@ -273,7 +273,7 @@ fn utf8_to_timestamp_ns_impl( #[cfg_attr(docsrs, doc(cfg(feature = "chrono-tz")))] pub fn parse_offset_tz(timezone: &str) -> Result { timezone.parse::().map_err(|_| { - Error::InvalidArgumentError(format!("timezone \"{}\" cannot be parsed", timezone)) + Error::InvalidArgumentError(format!("timezone \"{timezone}\" cannot be parsed")) }) } diff --git a/tests/it/array/binary/mod.rs b/tests/it/array/binary/mod.rs index 2dc185bde9e..a36a2a9d256 100644 --- a/tests/it/array/binary/mod.rs +++ b/tests/it/array/binary/mod.rs @@ -153,7 +153,7 @@ fn value_unchecked_with_wrong_offsets_panics() { fn debug() { let array = BinaryArray::::from([Some([1, 2].as_ref()), Some(&[]), None]); - assert_eq!(format!("{:?}", array), "BinaryArray[[1, 2], [], None]"); + assert_eq!(format!("{array:?}"), "BinaryArray[[1, 2], [], None]"); } #[test] diff --git a/tests/it/array/boolean/mod.rs b/tests/it/array/boolean/mod.rs index c9fa33906f8..73d143d1d2b 100644 --- a/tests/it/array/boolean/mod.rs +++ b/tests/it/array/boolean/mod.rs @@ -59,7 +59,7 @@ fn with_validity() { #[test] fn debug() { let array = BooleanArray::from([Some(true), None, Some(false)]); - assert_eq!(format!("{:?}", array), "BooleanArray[true, None, false]"); + assert_eq!(format!("{array:?}"), "BooleanArray[true, None, false]"); } #[test] diff --git a/tests/it/array/dictionary/mod.rs b/tests/it/array/dictionary/mod.rs index b139c94c532..8f6fa3f5a1a 100644 --- a/tests/it/array/dictionary/mod.rs +++ b/tests/it/array/dictionary/mod.rs @@ -21,7 +21,7 @@ fn try_new_ok() { ); assert!(!array.is_ordered()); - assert_eq!(format!("{:?}", array), "DictionaryArray[aa, a]"); + assert_eq!(format!("{array:?}"), "DictionaryArray[aa, a]"); } #[test] @@ -109,7 +109,7 @@ fn new_null() { let dt = DataType::Dictionary(i16::KEY_TYPE, Box::new(DataType::Int32), false); let array = DictionaryArray::::new_null(dt, 2); - assert_eq!(format!("{:?}", array), "DictionaryArray[None, None]"); + assert_eq!(format!("{array:?}"), "DictionaryArray[None, None]"); } #[test] @@ -117,7 +117,7 @@ fn new_empty() { let dt = DataType::Dictionary(i16::KEY_TYPE, Box::new(DataType::Int32), false); let array = DictionaryArray::::new_empty(dt); - assert_eq!(format!("{:?}", array), "DictionaryArray[]"); + assert_eq!(format!("{array:?}"), "DictionaryArray[]"); } #[test] @@ -129,7 +129,7 @@ fn with_validity() { let array = array.with_validity(Some([true, false].into())); - assert_eq!(format!("{:?}", array), "DictionaryArray[aa, None]"); + assert_eq!(format!("{array:?}"), "DictionaryArray[aa, None]"); } #[test] diff --git a/tests/it/array/equal/mod.rs b/tests/it/array/equal/mod.rs index a5d1884cf24..f479b478843 100644 --- a/tests/it/array/equal/mod.rs +++ b/tests/it/array/equal/mod.rs @@ -8,11 +8,11 @@ mod utf8; pub fn test_equal(lhs: &dyn Array, rhs: &dyn Array, expected: bool) { // equality is symmetric - assert!(equal(lhs, lhs), "\n{:?}\n{:?}", lhs, lhs); - assert!(equal(rhs, rhs), "\n{:?}\n{:?}", rhs, rhs); + assert!(equal(lhs, lhs), "\n{lhs:?}\n{lhs:?}"); + assert!(equal(rhs, rhs), "\n{rhs:?}\n{rhs:?}"); - assert_eq!(equal(lhs, rhs), expected, "\n{:?}\n{:?}", lhs, rhs); - assert_eq!(equal(rhs, lhs), expected, "\n{:?}\n{:?}", rhs, lhs); + assert_eq!(equal(lhs, rhs), expected, "\n{lhs:?}\n{rhs:?}"); + assert_eq!(equal(rhs, lhs), expected, "\n{rhs:?}\n{lhs:?}"); } #[allow(clippy::type_complexity)] diff --git a/tests/it/array/fixed_size_binary/mod.rs b/tests/it/array/fixed_size_binary/mod.rs index 920b5925b28..345d5da64c6 100644 --- a/tests/it/array/fixed_size_binary/mod.rs +++ b/tests/it/array/fixed_size_binary/mod.rs @@ -40,7 +40,7 @@ fn debug() { Some(Bitmap::from([true, false, true])), ); assert_eq!( - format!("{:?}", a), + format!("{a:?}"), "FixedSizeBinary(2)[[1, 2], None, [5, 6]]" ); } diff --git a/tests/it/array/fixed_size_list/mod.rs b/tests/it/array/fixed_size_list/mod.rs index 8281aee519c..23d37a2a212 100644 --- a/tests/it/array/fixed_size_list/mod.rs +++ b/tests/it/array/fixed_size_list/mod.rs @@ -47,7 +47,7 @@ fn with_validity() { fn debug() { let array = data(); - assert_eq!(format!("{:?}", array), "FixedSizeListArray[[10, 20], None]"); + assert_eq!(format!("{array:?}"), "FixedSizeListArray[[10, 20], None]"); } #[test] diff --git a/tests/it/array/list/mod.rs b/tests/it/array/list/mod.rs index bc3caef921f..4cbf4dbbece 100644 --- a/tests/it/array/list/mod.rs +++ b/tests/it/array/list/mod.rs @@ -17,7 +17,7 @@ fn debug() { None, ); - assert_eq!(format!("{:?}", array), "ListArray[[1, 2], [], [3], [4, 5]]"); + assert_eq!(format!("{array:?}"), "ListArray[[1, 2], [], [3], [4, 5]]"); } #[test] @@ -66,5 +66,5 @@ fn test_nested_display() { ); let expected = "ListArray[[[1, 2], [3, 4]], [[5, 6, 7], [], [8]], [[9, 10]]]"; - assert_eq!(format!("{:?}", nested), expected); + assert_eq!(format!("{nested:?}"), expected); } diff --git a/tests/it/array/primitive/fmt.rs b/tests/it/array/primitive/fmt.rs index 4f62e0bf22c..e09b0dc9d32 100644 --- a/tests/it/array/primitive/fmt.rs +++ b/tests/it/array/primitive/fmt.rs @@ -7,14 +7,14 @@ use arrow2::{ #[test] fn debug_int32() { let array = Int32Array::from(&[Some(1), None, Some(2)]); - assert_eq!(format!("{:?}", array), "Int32[1, None, 2]"); + assert_eq!(format!("{array:?}"), "Int32[1, None, 2]"); } #[test] fn debug_date32() { let array = Int32Array::from(&[Some(1), None, Some(2)]).to(DataType::Date32); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Date32[1970-01-02, None, 1970-01-03]" ); } @@ -23,7 +23,7 @@ fn debug_date32() { fn debug_time32s() { let array = Int32Array::from(&[Some(1), None, Some(2)]).to(DataType::Time32(TimeUnit::Second)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Time32(Second)[00:00:01, None, 00:00:02]" ); } @@ -33,7 +33,7 @@ fn debug_time32ms() { let array = Int32Array::from(&[Some(1), None, Some(2)]).to(DataType::Time32(TimeUnit::Millisecond)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Time32(Millisecond)[00:00:00.001, None, 00:00:00.002]" ); } @@ -42,20 +42,20 @@ fn debug_time32ms() { fn debug_interval_d() { let array = Int32Array::from(&[Some(1), None, Some(2)]).to(DataType::Interval(IntervalUnit::YearMonth)); - assert_eq!(format!("{:?}", array), "Interval(YearMonth)[1m, None, 2m]"); + assert_eq!(format!("{array:?}"), "Interval(YearMonth)[1m, None, 2m]"); } #[test] fn debug_int64() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Int64); - assert_eq!(format!("{:?}", array), "Int64[1, None, 2]"); + assert_eq!(format!("{array:?}"), "Int64[1, None, 2]"); } #[test] fn debug_date64() { let array = Int64Array::from(&[Some(1), None, Some(86400000)]).to(DataType::Date64); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Date64[1970-01-01, None, 1970-01-02]" ); } @@ -65,7 +65,7 @@ fn debug_time64us() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Time64(TimeUnit::Microsecond)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Time64(Microsecond)[00:00:00.000001, None, 00:00:00.000002]" ); } @@ -75,7 +75,7 @@ fn debug_time64ns() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Time64(TimeUnit::Nanosecond)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Time64(Nanosecond)[00:00:00.000000001, None, 00:00:00.000000002]" ); } @@ -85,7 +85,7 @@ fn debug_timestamp_s() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Timestamp(TimeUnit::Second, None)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Second, None)[1970-01-01 00:00:01, None, 1970-01-01 00:00:02]" ); } @@ -95,7 +95,7 @@ fn debug_timestamp_ms() { let array = Int64Array::from(&[Some(1), None, Some(2)]) .to(DataType::Timestamp(TimeUnit::Millisecond, None)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Millisecond, None)[1970-01-01 00:00:00.001, None, 1970-01-01 00:00:00.002]" ); } @@ -105,7 +105,7 @@ fn debug_timestamp_us() { let array = Int64Array::from(&[Some(1), None, Some(2)]) .to(DataType::Timestamp(TimeUnit::Microsecond, None)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Microsecond, None)[1970-01-01 00:00:00.000001, None, 1970-01-01 00:00:00.000002]" ); } @@ -115,7 +115,7 @@ fn debug_timestamp_ns() { let array = Int64Array::from(&[Some(1), None, Some(2)]) .to(DataType::Timestamp(TimeUnit::Nanosecond, None)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Nanosecond, None)[1970-01-01 00:00:00.000000001, None, 1970-01-01 00:00:00.000000002]" ); } @@ -127,7 +127,7 @@ fn debug_timestamp_tz_ns() { Some("+02:00".to_string()), )); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Nanosecond, Some(\"+02:00\"))[1970-01-01 02:00:00.000000001 +02:00, None, 1970-01-01 02:00:00.000000002 +02:00]" ); } @@ -139,7 +139,7 @@ fn debug_timestamp_tz_not_parsable() { Some("aa".to_string()), )); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Nanosecond, Some(\"aa\"))[1 (aa), None, 2 (aa)]" ); } @@ -152,7 +152,7 @@ fn debug_timestamp_tz1_ns() { Some("Europe/Lisbon".to_string()), )); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Timestamp(Nanosecond, Some(\"Europe/Lisbon\"))[1970-01-01 01:00:00.000000001 CET, None, 1970-01-01 01:00:00.000000002 CET]" ); } @@ -162,7 +162,7 @@ fn debug_duration_ms() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Duration(TimeUnit::Millisecond)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Duration(Millisecond)[1ms, None, 2ms]" ); } @@ -171,7 +171,7 @@ fn debug_duration_ms() { fn debug_duration_s() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Duration(TimeUnit::Second)); - assert_eq!(format!("{:?}", array), "Duration(Second)[1s, None, 2s]"); + assert_eq!(format!("{array:?}"), "Duration(Second)[1s, None, 2s]"); } #[test] @@ -179,7 +179,7 @@ fn debug_duration_us() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Duration(TimeUnit::Microsecond)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Duration(Microsecond)[1us, None, 2us]" ); } @@ -189,7 +189,7 @@ fn debug_duration_ns() { let array = Int64Array::from(&[Some(1), None, Some(2)]).to(DataType::Duration(TimeUnit::Nanosecond)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Duration(Nanosecond)[1ns, None, 2ns]" ); } @@ -198,7 +198,7 @@ fn debug_duration_ns() { fn debug_decimal() { let array = Int128Array::from(&[Some(12345), None, Some(23456)]).to(DataType::Decimal(5, 2)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Decimal(5, 2)[123.45, None, 234.56]" ); } @@ -207,7 +207,7 @@ fn debug_decimal() { fn debug_decimal1() { let array = Int128Array::from(&[Some(12345), None, Some(23456)]).to(DataType::Decimal(5, 1)); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Decimal(5, 1)[1234.5, None, 2345.6]" ); } @@ -216,7 +216,7 @@ fn debug_decimal1() { fn debug_interval_days_ms() { let array = DaysMsArray::from(&[Some(days_ms::new(1, 1)), None, Some(days_ms::new(2, 2))]); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Interval(DayTime)[1d1ms, None, 2d2ms]" ); } @@ -232,7 +232,7 @@ fn debug_months_days_ns() { let array = MonthsDaysNsArray::from(&data); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "Interval(MonthDayNano)[1m1d2ns, None, 2m3d3ns]" ); } diff --git a/tests/it/array/struct_/mod.rs b/tests/it/array/struct_/mod.rs index 3eb2f6b5cbc..cd32eee3f75 100644 --- a/tests/it/array/struct_/mod.rs +++ b/tests/it/array/struct_/mod.rs @@ -21,7 +21,7 @@ fn debug() { Some(Bitmap::from([true, true, false, true])), ); assert_eq!( - format!("{:?}", array), + format!("{array:?}"), "StructArray[{b: false, c: 42}, {b: false, c: 28}, None, {b: true, c: 31}]" ); } diff --git a/tests/it/array/union.rs b/tests/it/array/union.rs index c250c3cceea..48a1d98f975 100644 --- a/tests/it/array/union.rs +++ b/tests/it/array/union.rs @@ -34,7 +34,7 @@ fn sparse_debug() -> Result<()> { let array = UnionArray::new(data_type, types, fields, None); - assert_eq!(format!("{:?}", array), "UnionArray[1, None, c]"); + assert_eq!(format!("{array:?}"), "UnionArray[1, None, c]"); Ok(()) } @@ -55,7 +55,7 @@ fn dense_debug() -> Result<()> { let array = UnionArray::new(data_type, types, fields, offsets); - assert_eq!(format!("{:?}", array), "UnionArray[1, None, c]"); + assert_eq!(format!("{array:?}"), "UnionArray[1, None, c]"); Ok(()) } diff --git a/tests/it/array/utf8/mod.rs b/tests/it/array/utf8/mod.rs index d16479c1740..e73c6880536 100644 --- a/tests/it/array/utf8/mod.rs +++ b/tests/it/array/utf8/mod.rs @@ -156,7 +156,7 @@ fn index_out_of_bounds_panics() { fn debug() { let array = Utf8Array::::from([Some("aa"), Some(""), None]); - assert_eq!(format!("{:?}", array), "Utf8Array[aa, , None]"); + assert_eq!(format!("{array:?}"), "Utf8Array[aa, , None]"); } #[test] diff --git a/tests/it/bitmap/immutable.rs b/tests/it/bitmap/immutable.rs index 96f0584c99a..aa6c8133acf 100644 --- a/tests/it/bitmap/immutable.rs +++ b/tests/it/bitmap/immutable.rs @@ -37,5 +37,5 @@ fn debug() { let b = Bitmap::from([true, true, false, true, true, true, true, true, true]); let b = b.slice(2, 7); - assert_eq!(format!("{:?}", b), "[0b111110__, 0b_______1]"); + assert_eq!(format!("{b:?}"), "[0b111110__, 0b_______1]"); } diff --git a/tests/it/bitmap/mutable.rs b/tests/it/bitmap/mutable.rs index 6d4efd290df..9fb785993ee 100644 --- a/tests/it/bitmap/mutable.rs +++ b/tests/it/bitmap/mutable.rs @@ -274,19 +274,19 @@ fn extend_from_bitmap_offset() { #[test] fn debug() { let mut b = MutableBitmap::new(); - assert_eq!(format!("{:?}", b), "[]"); + assert_eq!(format!("{b:?}"), "[]"); b.push(true); b.push(false); - assert_eq!(format!("{:?}", b), "[0b______01]"); + assert_eq!(format!("{b:?}"), "[0b______01]"); b.push(false); b.push(false); b.push(false); b.push(false); b.push(true); b.push(true); - assert_eq!(format!("{:?}", b), "[0b11000001]"); + assert_eq!(format!("{b:?}"), "[0b11000001]"); b.push(true); - assert_eq!(format!("{:?}", b), "[0b11000001, 0b_______1]"); + assert_eq!(format!("{b:?}"), "[0b11000001, 0b_______1]"); } #[test] diff --git a/tests/it/buffer/immutable.rs b/tests/it/buffer/immutable.rs index 9398759e955..7e5661fdd59 100644 --- a/tests/it/buffer/immutable.rs +++ b/tests/it/buffer/immutable.rs @@ -33,7 +33,7 @@ fn from_iter() { fn debug() { let buffer = Buffer::::from(vec![0, 1, 2, 3]); let buffer = buffer.slice(1, 2); - let a = format!("{:?}", buffer); + let a = format!("{buffer:?}"); assert_eq!(a, "[1, 2]") } diff --git a/tests/it/compute/cast.rs b/tests/it/compute/cast.rs index 7973ad798fa..6a1871746a7 100644 --- a/tests/it/compute/cast.rs +++ b/tests/it/compute/cast.rs @@ -479,15 +479,14 @@ fn consistency() { if can_cast_types(d1, d2) { let result = cast(array.as_ref(), d2, CastOptions::default()); if let Ok(result) = result { - assert_eq!(result.data_type(), d2, "type not equal: {:?} {:?}", d1, d2); + assert_eq!(result.data_type(), d2, "type not equal: {d1:?} {d2:?}"); } else { panic!( - "Cast should have not have failed {:?} {:?}: {:?}", - d1, d2, result + "Cast should have not have failed {d1:?} {d2:?}: {result:?}" ); } } else if cast(array.as_ref(), d2, CastOptions::default()).is_ok() { - panic!("Cast should have failed {:?} {:?}", d1, d2); + panic!("Cast should have failed {d1:?} {d2:?}"); } } } diff --git a/tests/it/io/csv/write.rs b/tests/it/io/csv/write.rs index 87a83170e03..2800c3bd77c 100644 --- a/tests/it/io/csv/write.rs +++ b/tests/it/io/csv/write.rs @@ -415,12 +415,12 @@ fn write_escaping_resize_local_buf() { let a = Utf8Array::::from_slice([payload]); let chunk = Chunk::new(vec![a.boxed()]); - test_generic(chunk, &format!("\"{}\"\n", payload)); + test_generic(chunk, &format!("\"{payload}\"\n")); let a = Utf8Array::::from_slice([payload]); let chunk = Chunk::new(vec![a.boxed()]); - test_generic(chunk, &format!("\"{}\"\n", payload)); + test_generic(chunk, &format!("\"{payload}\"\n")); } } diff --git a/tests/it/io/ipc/common.rs b/tests/it/io/ipc/common.rs index 6254c8f5bbd..a0889670f3e 100644 --- a/tests/it/io/ipc/common.rs +++ b/tests/it/io/ipc/common.rs @@ -15,8 +15,7 @@ type IpcRead = (Schema, Vec, Vec>>); pub fn read_gzip_json(version: &str, file_name: &str) -> Result { let testdata = crate::test_util::arrow_test_data(); let file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.json.gz", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.json.gz" )) .unwrap(); let mut gz = GzDecoder::new(&file); @@ -54,8 +53,7 @@ pub fn read_arrow_stream( ) -> IpcRead { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.stream", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.stream" )) .unwrap(); diff --git a/tests/it/io/ipc/read/file.rs b/tests/it/io/ipc/read/file.rs index 515a6ede92f..e83f08974d9 100644 --- a/tests/it/io/ipc/read/file.rs +++ b/tests/it/io/ipc/read/file.rs @@ -9,8 +9,7 @@ use super::super::common::read_gzip_json; fn test_file(version: &str, file_name: &str) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.arrow_file", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.arrow_file" ))?; // read expected JSON output @@ -167,8 +166,7 @@ fn read_generated_200_compression_zstd() -> Result<()> { fn test_projection(version: &str, file_name: &str, columns: Vec) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.arrow_file", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.arrow_file" ))?; let (schema, _, chunks) = read_gzip_json(version, file_name)?; @@ -233,8 +231,7 @@ fn test_does_not_panic() { let file_name = "generated_primitive"; let testdata = crate::test_util::arrow_test_data(); let path = format!( - "{}/arrow-ipc-stream/integration/{}/{}.arrow_file", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.arrow_file" ); let original = std::fs::read(path).unwrap(); @@ -250,8 +247,7 @@ fn test_does_not_panic() { fn test_limit(version: &str, file_name: &str, limit: usize) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.arrow_file", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.arrow_file" ))?; let (schema, _, _) = read_gzip_json(version, file_name)?; diff --git a/tests/it/io/ipc/read/stream.rs b/tests/it/io/ipc/read/stream.rs index ab8ae45a0e2..404954c3e48 100644 --- a/tests/it/io/ipc/read/stream.rs +++ b/tests/it/io/ipc/read/stream.rs @@ -9,8 +9,7 @@ use crate::io::ipc::common::read_gzip_json; fn test_file(version: &str, file_name: &str) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.stream", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.stream" ))?; let metadata = read_stream_metadata(&mut file)?; @@ -105,8 +104,7 @@ fn read_generated_200_compression_zstd() -> Result<()> { fn test_projection(version: &str, file_name: &str, columns: Vec) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.stream", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.stream" ))?; let metadata = read_stream_metadata(&mut file)?; diff --git a/tests/it/io/ipc/read_file_async.rs b/tests/it/io/ipc/read_file_async.rs index b8b61853a3d..8b74e6592c4 100644 --- a/tests/it/io/ipc/read_file_async.rs +++ b/tests/it/io/ipc/read_file_async.rs @@ -10,8 +10,7 @@ use crate::io::ipc::common::read_gzip_json; async fn test_file(version: &str, file_name: &str) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.arrow_file", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.arrow_file" )) .await? .compat(); diff --git a/tests/it/io/ipc/read_stream_async.rs b/tests/it/io/ipc/read_stream_async.rs index 593e2b0aeba..bb248932e9a 100644 --- a/tests/it/io/ipc/read_stream_async.rs +++ b/tests/it/io/ipc/read_stream_async.rs @@ -10,8 +10,7 @@ use crate::io::ipc::common::read_gzip_json; async fn test_file(version: &str, file_name: &str) -> Result<()> { let testdata = crate::test_util::arrow_test_data(); let mut file = File::open(format!( - "{}/arrow-ipc-stream/integration/{}/{}.stream", - testdata, version, file_name + "{testdata}/arrow-ipc-stream/integration/{version}/{file_name}.stream" )) .await? .compat(); diff --git a/tests/it/io/parquet/read.rs b/tests/it/io/parquet/read.rs index 233560398f9..a07c394bc4c 100644 --- a/tests/it/io/parquet/read.rs +++ b/tests/it/io/parquet/read.rs @@ -19,14 +19,13 @@ fn test_pyarrow_integration( } let use_dict = if use_dict { "dict/" } else { "" }; let compression = if let Some(compression) = compression { - format!("{}/", compression) + format!("{compression}/") } else { "".to_string() }; let required_str = if required { "required" } else { "nullable" }; let path = format!( - "fixtures/pyarrow3/v{}/{}{}{}_{}_10.parquet", - version, use_dict, compression, type_, required_str + "fixtures/pyarrow3/v{version}/{use_dict}{compression}{type_}_{required_str}_10.parquet" ); let mut file = File::open(path).unwrap(); @@ -610,8 +609,7 @@ fn invalid_utf8() -> Result<()> { let error = reader.collect::>>().unwrap_err(); assert!( error.to_string().contains("invalid utf-8"), - "unexpected error: {}", - error + "unexpected error: {error}" ); Ok(()) } diff --git a/tests/it/io/print.rs b/tests/it/io/print.rs index 206d33f181d..8cbc15a95f8 100644 --- a/tests/it/io/print.rs +++ b/tests/it/io/print.rs @@ -30,7 +30,7 @@ fn write_basics() -> Result<()> { let actual: Vec<&str> = table.lines().collect(); - assert_eq!(expected, actual, "Actual result:\n{}", table); + assert_eq!(expected, actual, "Actual result:\n{table}"); Ok(()) } @@ -61,7 +61,7 @@ fn write_null() -> Result<()> { let actual: Vec<&str> = table.lines().collect(); - assert_eq!(expected, actual, "Actual result:\n{:#?}", table); + assert_eq!(expected, actual, "Actual result:\n{table:#?}"); Ok(()) } @@ -88,7 +88,7 @@ fn write_dictionary() -> Result<()> { let actual: Vec<&str> = table.lines().collect(); - assert_eq!(expected, actual, "Actual result:\n{}", table); + assert_eq!(expected, actual, "Actual result:\n{table}"); Ok(()) } @@ -109,7 +109,7 @@ fn dictionary_validities() -> Result<()> { let actual: Vec<&str> = table.lines().collect(); - assert_eq!(expected, actual, "Actual result:\n{}", table); + assert_eq!(expected, actual, "Actual result:\n{table}"); Ok(()) } @@ -345,7 +345,7 @@ fn write_struct() -> Result<()> { let actual: Vec<&str> = table.lines().collect(); - assert_eq!(expected, actual, "Actual result:\n{}", table); + assert_eq!(expected, actual, "Actual result:\n{table}"); Ok(()) } @@ -375,7 +375,7 @@ fn write_union() -> Result<()> { let actual: Vec<&str> = table.lines().collect(); - assert_eq!(expected, actual, "Actual result:\n{}", table); + assert_eq!(expected, actual, "Actual result:\n{table}"); Ok(()) } diff --git a/tests/it/temporal_conversions.rs b/tests/it/temporal_conversions.rs index 91dd1ba8efc..fcccc546b46 100644 --- a/tests/it/temporal_conversions.rs +++ b/tests/it/temporal_conversions.rs @@ -13,7 +13,7 @@ fn naive() { "1996-12-19 13:39:57-03:00", // missing T ]); let r = temporal_conversions::utf8_to_naive_timestamp_ns(&array, fmt); - assert_eq!(format!("{:?}", r), expected); + assert_eq!(format!("{r:?}"), expected); let fmt = "%Y-%m-%dT%H:%M:%S"; // no tz info let array = Utf8Array::::from_slice([ @@ -22,7 +22,7 @@ fn naive() { "1996-12-19 13:39:57-03:00", // missing T ]); let r = temporal_conversions::utf8_to_naive_timestamp_ns(&array, fmt); - assert_eq!(format!("{:?}", r), expected); + assert_eq!(format!("{r:?}"), expected); } #[test] @@ -35,7 +35,7 @@ fn naive_no_tz() { "1996-12-19 13:39:57", // missing T ]); let r = temporal_conversions::utf8_to_naive_timestamp_ns(&array, fmt); - assert_eq!(format!("{:?}", r), expected); + assert_eq!(format!("{r:?}"), expected); } #[test] @@ -50,7 +50,7 @@ fn tz_aware() { "1996-12-19 13:39:57.0-03:00", ]); let r = temporal_conversions::utf8_to_timestamp_ns(&array, fmt, tz).unwrap(); - assert_eq!(format!("{:?}", r), expected); + assert_eq!(format!("{r:?}"), expected); } #[test] @@ -64,7 +64,7 @@ fn tz_aware_no_timezone() { "1996-12-19 13:39:57.0", ]); let r = temporal_conversions::utf8_to_timestamp_ns(&array, fmt, tz).unwrap(); - assert_eq!(format!("{:?}", r), expected); + assert_eq!(format!("{r:?}"), expected); } #[test] @@ -81,7 +81,7 @@ fn add_interval_fixed_offset() { &timezone, ); let r = temporal_conversions::timestamp_to_datetime(r, timeunit, &timezone); - assert_eq!("1972-02-29 02:01:00 +01:00", format!("{}", r)); + assert_eq!("1972-02-29 02:01:00 +01:00", format!("{r}")); let r = temporal_conversions::add_interval( timestamp, @@ -90,7 +90,7 @@ fn add_interval_fixed_offset() { &timezone, ); let r = temporal_conversions::timestamp_to_datetime(r, timeunit, &timezone); - assert_eq!("1972-03-29 02:01:00 +01:00", format!("{}", r)); + assert_eq!("1972-03-29 02:01:00 +01:00", format!("{r}")); let r = temporal_conversions::add_interval( timestamp, @@ -99,7 +99,7 @@ fn add_interval_fixed_offset() { &timezone, ); let r = temporal_conversions::timestamp_to_datetime(r, timeunit, &timezone); - assert_eq!("1974-03-01 02:01:00 +01:00", format!("{}", r)); + assert_eq!("1974-03-01 02:01:00 +01:00", format!("{r}")); let r = temporal_conversions::add_interval( timestamp, @@ -108,7 +108,7 @@ fn add_interval_fixed_offset() { &timezone, ); let r = temporal_conversions::timestamp_to_datetime(r, timeunit, &timezone); - assert_eq!("1972-01-29 02:01:00 +01:00", format!("{}", r)); + assert_eq!("1972-01-29 02:01:00 +01:00", format!("{r}")); } #[cfg(feature = "chrono-tz")] @@ -127,7 +127,7 @@ fn add_interval_timezone() { &timezone, ); let r = temporal_conversions::timestamp_to_datetime(r, timeunit, &timezone); - assert_eq!("2020-03-29 02:00:00 WEST", format!("{}", r)); + assert_eq!("2020-03-29 02:00:00 WEST", format!("{r}")); // crosses two summer time changes and thus adds only 1 hour let r = temporal_conversions::add_interval( @@ -137,5 +137,5 @@ fn add_interval_timezone() { &timezone, ); let r = temporal_conversions::timestamp_to_datetime(r, timeunit, &timezone); - assert_eq!("2020-10-29 01:00:00 WET", format!("{}", r)); + assert_eq!("2020-10-29 01:00:00 WET", format!("{r}")); }