This is an automated email from the ASF dual-hosted git repository.
viirya pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new 69997fe0 chore: Make rust clippy happy (#701)
69997fe0 is described below
commit 69997fe09fc5eff4153fbb693ad33dd3bc8bd4d7
Author: Xuanwo <[email protected]>
AuthorDate: Mon Jul 22 02:51:08 2024 +0800
chore: Make rust clippy happy (#701)
* chore: Make rust clippy happy
Signed-off-by: Xuanwo <[email protected]>
* Format code
Signed-off-by: Xuanwo <[email protected]>
---------
Signed-off-by: Xuanwo <[email protected]>
---
native/core/benches/cast_from_string.rs | 4 ++--
native/core/benches/cast_numeric.rs | 4 ++--
native/core/benches/shuffle_writer.rs | 4 ++--
native/core/src/errors.rs | 2 +-
native/core/src/execution/datafusion/spark_hash.rs | 2 +-
native/core/src/parquet/read/values.rs | 10 ++++----
native/spark-expr/src/cast.rs | 10 ++++----
native/spark-expr/src/kernels/temporal.rs | 28 +++++++++++-----------
8 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/native/core/benches/cast_from_string.rs
b/native/core/benches/cast_from_string.rs
index efc7987c..51410a68 100644
--- a/native/core/benches/cast_from_string.rs
+++ b/native/core/benches/cast_from_string.rs
@@ -75,8 +75,8 @@ fn create_utf8_batch() -> RecordBatch {
}
}
let array = b.finish();
- let batch = RecordBatch::try_new(schema.clone(),
vec![Arc::new(array)]).unwrap();
- batch
+
+ RecordBatch::try_new(schema.clone(), vec![Arc::new(array)]).unwrap()
}
fn config() -> Criterion {
diff --git a/native/core/benches/cast_numeric.rs
b/native/core/benches/cast_numeric.rs
index f9ed1fae..dc0ceea7 100644
--- a/native/core/benches/cast_numeric.rs
+++ b/native/core/benches/cast_numeric.rs
@@ -63,8 +63,8 @@ fn create_int32_batch() -> RecordBatch {
}
}
let array = b.finish();
- let batch = RecordBatch::try_new(schema.clone(),
vec![Arc::new(array)]).unwrap();
- batch
+
+ RecordBatch::try_new(schema.clone(), vec![Arc::new(array)]).unwrap()
}
fn config() -> Criterion {
diff --git a/native/core/benches/shuffle_writer.rs
b/native/core/benches/shuffle_writer.rs
index 4bebd045..6f287186 100644
--- a/native/core/benches/shuffle_writer.rs
+++ b/native/core/benches/shuffle_writer.rs
@@ -65,8 +65,8 @@ fn create_batch() -> RecordBatch {
}
}
let array = b.finish();
- let batch = RecordBatch::try_new(schema.clone(),
vec![Arc::new(array)]).unwrap();
- batch
+
+ RecordBatch::try_new(schema.clone(), vec![Arc::new(array)]).unwrap()
}
fn config() -> Criterion {
diff --git a/native/core/src/errors.rs b/native/core/src/errors.rs
index 3ed402d1..92799bcf 100644
--- a/native/core/src/errors.rs
+++ b/native/core/src/errors.rs
@@ -778,7 +778,7 @@ mod tests {
_class: JClass,
input: JString,
) -> jstring {
- try_unwrap_or_throw(&e, |mut env| {
+ try_unwrap_or_throw(e, |mut env| {
let input: String = env
.get_string(&input)
.expect("Couldn't get java string!")
diff --git a/native/core/src/execution/datafusion/spark_hash.rs
b/native/core/src/execution/datafusion/spark_hash.rs
index 15bded3a..e429f543 100644
--- a/native/core/src/execution/datafusion/spark_hash.rs
+++ b/native/core/src/execution/datafusion/spark_hash.rs
@@ -686,7 +686,7 @@ mod tests {
#[test]
fn test_str() {
- let input = vec![
+ let input = [
"hello", "bar", "", "😁", "天地", "a", "ab", "abc", "abcd", "abcde",
]
.iter()
diff --git a/native/core/src/parquet/read/values.rs
b/native/core/src/parquet/read/values.rs
index 8eae330a..b89face0 100644
--- a/native/core/src/parquet/read/values.rs
+++ b/native/core/src/parquet/read/values.rs
@@ -1184,7 +1184,7 @@ mod test {
let expected = hex::decode("8adb1834301dab37f1").unwrap();
let num = source.len() / 4;
let mut dest: Vec<u8> = vec![b' '; num];
- copy_i32_to_i8(&source.as_bytes(), dest.as_mut_slice(), num);
+ copy_i32_to_i8(source.as_bytes(), dest.as_mut_slice(), num);
assert_eq!(expected.as_bytes(), dest.as_bytes());
}
@@ -1196,7 +1196,7 @@ mod test {
let expected =
hex::decode("8a00db001800340030001d00ab003700f100").unwrap();
let num = source.len() / 4;
let mut dest: Vec<u8> = vec![b' '; num * 2];
- copy_i32_to_u8(&source.as_bytes(), dest.as_mut_slice(), num);
+ copy_i32_to_u8(source.as_bytes(), dest.as_mut_slice(), num);
assert_eq!(expected.as_bytes(), dest.as_bytes());
}
@@ -1208,7 +1208,7 @@ mod test {
let expected =
hex::decode("8a0edb93182634f430021d2babe3378df147").unwrap();
let num = source.len() / 4;
let mut dest: Vec<u8> = vec![b' '; num * 2];
- copy_i32_to_i16(&source.as_bytes(), dest.as_mut_slice(), num);
+ copy_i32_to_i16(source.as_bytes(), dest.as_mut_slice(), num);
assert_eq!(expected.as_bytes(), dest.as_bytes());
}
@@ -1224,7 +1224,7 @@ mod test {
.unwrap();
let num = source.len() / 4;
let mut dest: Vec<u8> = vec![b' '; num * 4];
- copy_i32_to_u16(&source.as_bytes(), dest.as_mut_slice(), num);
+ copy_i32_to_u16(source.as_bytes(), dest.as_mut_slice(), num);
assert_eq!(expected.as_bytes(), dest.as_bytes());
}
@@ -1237,7 +1237,7 @@ mod test {
let expected =
hex::decode("ffffff7f00000000000000800000000001000080000000000200008000000000030000800000000004000080000000000500008000000000060000800000000007000080000000000800008000000000").unwrap();
let num = source.len() / 4;
let mut dest: Vec<u8> = vec![b' '; num * 8];
- copy_i32_to_u32(&source.as_bytes(), dest.as_mut_slice(), num);
+ copy_i32_to_u32(source.as_bytes(), dest.as_mut_slice(), num);
assert_eq!(expected.as_bytes(), dest.as_bytes());
}
}
diff --git a/native/spark-expr/src/cast.rs b/native/spark-expr/src/cast.rs
index 8702ce70..9a47cc87 100644
--- a/native/spark-expr/src/cast.rs
+++ b/native/spark-expr/src/cast.rs
@@ -1854,7 +1854,7 @@ mod tests {
"2020-01-01T",
] {
for eval_mode in &[EvalMode::Legacy, EvalMode::Ansi,
EvalMode::Try] {
- assert_eq!(date_parser(*date, *eval_mode).unwrap(),
Some(18262));
+ assert_eq!(date_parser(date, *eval_mode).unwrap(),
Some(18262));
}
}
@@ -1875,14 +1875,14 @@ mod tests {
"--262143-12-31 ",
] {
for eval_mode in &[EvalMode::Legacy, EvalMode::Try] {
- assert_eq!(date_parser(*date, *eval_mode).unwrap(), None);
+ assert_eq!(date_parser(date, *eval_mode).unwrap(), None);
}
- assert!(date_parser(*date, EvalMode::Ansi).is_err());
+ assert!(date_parser(date, EvalMode::Ansi).is_err());
}
for date in &["-3638-5"] {
for eval_mode in &[EvalMode::Legacy, EvalMode::Try,
EvalMode::Ansi] {
- assert_eq!(date_parser(*date, *eval_mode).unwrap(),
Some(-2048160));
+ assert_eq!(date_parser(date, *eval_mode).unwrap(),
Some(-2048160));
}
}
@@ -1898,7 +1898,7 @@ mod tests {
"-0973250",
] {
for eval_mode in &[EvalMode::Legacy, EvalMode::Try,
EvalMode::Ansi] {
- assert_eq!(date_parser(*date, *eval_mode).unwrap(), None);
+ assert_eq!(date_parser(date, *eval_mode).unwrap(), None);
}
}
}
diff --git a/native/spark-expr/src/kernels/temporal.rs
b/native/spark-expr/src/kernels/temporal.rs
index 6f2474e8..cda4bef5 100644
--- a/native/spark-expr/src/kernels/temporal.rs
+++ b/native/spark-expr/src/kernels/temporal.rs
@@ -838,7 +838,7 @@ mod tests {
assert!(array.values().get(i) >= a.values().get(i))
}
}
- _ => assert!(false),
+ _ => unreachable!(),
}
}
}
@@ -854,9 +854,9 @@ mod tests {
let mut vec: Vec<i32> = Vec::with_capacity(size * formats.len());
let mut fmt_vec: Vec<&str> = Vec::with_capacity(size * formats.len());
for i in 0..size {
- for j in 0..formats.len() {
+ for fmt_value in &formats {
vec.push(i as i32 * 1_000_001);
- fmt_vec.push(formats[j]);
+ fmt_vec.push(fmt_value);
}
}
@@ -928,7 +928,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
if let Ok(a) = date_trunc_array_fmt_dyn(&array_dict, &fmt_array) {
for i in 0..array.len() {
@@ -937,7 +937,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
if let Ok(a) = date_trunc_array_fmt_dyn(&array, &fmt_dict) {
for i in 0..array.len() {
@@ -946,7 +946,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
if let Ok(a) = date_trunc_array_fmt_dyn(&array_dict, &fmt_dict) {
for i in 0..array.len() {
@@ -955,7 +955,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
}
@@ -991,7 +991,7 @@ mod tests {
assert!(array.values().get(i) >= a.values().get(i))
}
}
- _ => assert!(false),
+ _ => unreachable!(),
}
}
}
@@ -1023,9 +1023,9 @@ mod tests {
let mut vec: Vec<i64> = Vec::with_capacity(size * formats.len());
let mut fmt_vec: Vec<&str> = Vec::with_capacity(size * formats.len());
for i in 0..size {
- for j in 0..formats.len() {
+ for fmt_value in &formats {
vec.push(i as i64 * 1_000_000_001);
- fmt_vec.push(formats[j]);
+ fmt_vec.push(fmt_value);
}
}
@@ -1103,7 +1103,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
if let Ok(a) = timestamp_trunc_array_fmt_dyn(&array_dict, &fmt_array) {
for i in 0..array.len() {
@@ -1116,7 +1116,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
if let Ok(a) = timestamp_trunc_array_fmt_dyn(&array, &fmt_dict) {
for i in 0..array.len() {
@@ -1129,7 +1129,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
if let Ok(a) = timestamp_trunc_array_fmt_dyn(&array_dict, &fmt_dict) {
for i in 0..array.len() {
@@ -1142,7 +1142,7 @@ mod tests {
)
}
} else {
- assert!(false)
+ unreachable!()
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]