Skip to content

Commit

Permalink
new clippy rules (#5881)
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangpengHao authored Jun 13, 2024
1 parent 8e476ae commit 3715d54
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion arrow-data/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use arrow_buffer::{
bit_util, i256, ArrowNativeType, Buffer, IntervalDayTime, IntervalMonthDayNano, MutableBuffer,
};
use arrow_schema::{ArrowError, DataType, UnionMode};
use std::mem;
use std::ops::Range;
use std::sync::Arc;
use std::{mem, usize};

use crate::{equal, validate_binary_view, validate_string_view};

Expand Down
2 changes: 1 addition & 1 deletion arrow-ipc/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ mod tests {
let array1 = NullArray::new(32);
let array2 = Int32Array::from(vec![1; 32]);
let array3 = NullArray::new(32);
let array4 = Float64Array::from(vec![std::f64::NAN; 32]);
let array4 = Float64Array::from(vec![f64::NAN; 32]);
let batch = RecordBatch::try_new(
Arc::new(schema.clone()),
vec![
Expand Down
8 changes: 4 additions & 4 deletions arrow-json/src/reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2282,8 +2282,8 @@ mod tests {
fn test_coercing_primitive_into_string_decoder() {
let buf = &format!(
r#"[{{"a": 1, "b": "A", "c": "T"}}, {{"a": 2, "b": "BB", "c": "F"}}, {{"a": {}, "b": 123, "c": false}}, {{"a": {}, "b": 789, "c": true}}]"#,
(std::i32::MAX as i64 + 10),
std::i64::MAX - 10
(i32::MAX as i64 + 10),
i64::MAX - 10
);
let schema = Schema::new(vec![
Field::new("a", DataType::Float64, true),
Expand All @@ -2306,8 +2306,8 @@ mod tests {
Arc::new(Float64Array::from(vec![
1.0,
2.0,
(std::i32::MAX as i64 + 10) as f64,
(std::i64::MAX - 10) as f64
(i32::MAX as i64 + 10) as f64,
(i64::MAX - 10) as f64
])),
Arc::new(StringArray::from(vec!["A", "BB", "123", "789"])),
Arc::new(StringArray::from(vec!["T", "F", "false", "true"])),
Expand Down
68 changes: 34 additions & 34 deletions parquet/src/column/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);
test!(
test_read_plain_v2_int32,
Expand All @@ -684,8 +684,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);

test!(
Expand All @@ -697,8 +697,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
17,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);
test!(
test_read_plain_v2_int32_uneven,
Expand All @@ -709,8 +709,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
17,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);

test!(
Expand All @@ -722,8 +722,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
512,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);
test!(
test_read_plain_v2_int32_multi_page,
Expand All @@ -734,8 +734,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
512,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);

// test cases when column descriptor has MAX_DEF_LEVEL = 0 and MAX_REP_LEVEL = 0
Expand All @@ -748,8 +748,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);
test!(
test_read_plain_v2_int32_required_non_repeated,
Expand All @@ -760,8 +760,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i32::MIN,
std::i32::MAX
i32::MIN,
i32::MAX
);

test!(
Expand All @@ -773,8 +773,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);
test!(
test_read_plain_v2_int64,
Expand All @@ -785,8 +785,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);

test!(
Expand All @@ -798,8 +798,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
17,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);
test!(
test_read_plain_v2_int64_uneven,
Expand All @@ -810,8 +810,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
17,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);

test!(
Expand All @@ -823,8 +823,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
512,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);
test!(
test_read_plain_v2_int64_multi_page,
Expand All @@ -835,8 +835,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
512,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);

// test cases when column descriptor has MAX_DEF_LEVEL = 0 and MAX_REP_LEVEL = 0
Expand All @@ -849,8 +849,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);
test!(
test_read_plain_v2_int64_required_non_repeated,
Expand All @@ -861,8 +861,8 @@ mod tests {
NUM_PAGES,
NUM_LEVELS,
16,
std::i64::MIN,
std::i64::MAX
i64::MIN,
i64::MAX
);

test!(
Expand Down Expand Up @@ -1037,8 +1037,8 @@ mod tests {
num_pages,
num_levels,
batch_size,
std::i32::MIN,
std::i32::MAX,
i32::MIN,
i32::MAX,
false,
);
}
Expand Down
16 changes: 8 additions & 8 deletions parquet/src/encodings/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,14 +1624,14 @@ mod tests {
#[test]
fn test_delta_bit_packed_int64_min_max() {
let block_data = vec![
i64::min_value(),
i64::max_value(),
i64::min_value(),
i64::max_value(),
i64::min_value(),
i64::max_value(),
i64::min_value(),
i64::max_value(),
i64::MIN,
i64::MAX,
i64::MIN,
i64::MAX,
i64::MIN,
i64::MAX,
i64::MIN,
i64::MAX,
];
test_delta_bit_packed_decode::<Int64Type>(vec![block_data]);
}
Expand Down
6 changes: 3 additions & 3 deletions parquet_derive_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ mod tests {
maybe_usize: Some(4456),
isize: -365,
float: 3.5,
double: std::f64::NAN,
double: f64::NAN,
maybe_float: None,
maybe_double: Some(std::f64::MAX),
maybe_double: Some(f64::MAX),
borrowed_maybe_a_string: &maybe_a_string,
borrowed_maybe_a_str: &maybe_a_str,
now: chrono::Utc::now().naive_local(),
Expand Down Expand Up @@ -180,7 +180,7 @@ mod tests {
u64: 4563424,
isize: -365,
float: 3.5,
double: std::f64::NAN,
double: f64::NAN,
now: chrono::Utc::now().naive_local(),
date: chrono::naive::NaiveDate::from_ymd_opt(2015, 3, 14).unwrap(),
uuid: uuid::Uuid::new_v4(),
Expand Down

0 comments on commit 3715d54

Please sign in to comment.