This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f3c8c3b4 fix clippy in nightly (#5238)
8f3c8c3b4 is described below

commit 8f3c8c3b43cb076c9f87c9168798dbfaa766a828
Author: jakevin <[email protected]>
AuthorDate: Sat Feb 11 02:50:21 2023 +0800

    fix clippy in nightly (#5238)
---
 benchmarks/src/bin/tpch.rs                         |  5 +----
 datafusion/common/src/dfschema.rs                  |  5 +----
 datafusion/common/src/scalar.rs                    |  2 --
 datafusion/common/src/table_reference.rs           |  2 +-
 datafusion/core/src/physical_plan/empty.rs         |  2 --
 datafusion/core/src/physical_plan/sorts/sort.rs    |  1 -
 .../physical_plan/sorts/sort_preserving_merge.rs   |  9 ++-------
 datafusion/core/src/physical_plan/unnest.rs        |  8 +++-----
 .../windows/bounded_window_agg_exec.rs             |  1 -
 datafusion/physical-expr/src/aggregate/average.rs  |  1 -
 .../physical-expr/src/aggregate/count_distinct.rs  |  1 -
 datafusion/physical-expr/src/aggregate/min_max.rs  |  4 ----
 datafusion/physical-expr/src/aggregate/sum.rs      |  1 -
 datafusion/physical-expr/src/expressions/binary.rs |  1 -
 .../src/expressions/binary/kernels_arrow.rs        |  2 +-
 .../physical-expr/src/expressions/in_list.rs       |  2 +-
 datafusion/physical-expr/src/window/nth_value.rs   |  1 -
 datafusion/substrait/src/logical_plan/consumer.rs  | 22 +++++++++-------------
 18 files changed, 19 insertions(+), 51 deletions(-)

diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rs
index 63eb9127e..b869490a5 100644
--- a/benchmarks/src/bin/tpch.rs
+++ b/benchmarks/src/bin/tpch.rs
@@ -445,10 +445,7 @@ impl RunContext {
                 .duration_since(SystemTime::UNIX_EPOCH)
                 .expect("current time is later than UNIX_EPOCH")
                 .as_secs(),
-            arguments: std::env::args()
-                .skip(1)
-                .into_iter()
-                .collect::<Vec<String>>(),
+            arguments: std::env::args().skip(1).collect::<Vec<String>>(),
         }
     }
 }
diff --git a/datafusion/common/src/dfschema.rs 
b/datafusion/common/src/dfschema.rs
index 969695be2..e4a591ad3 100644
--- a/datafusion/common/src/dfschema.rs
+++ b/datafusion/common/src/dfschema.rs
@@ -1135,9 +1135,6 @@ mod tests {
     }
 
     fn test_metadata_n(n: usize) -> HashMap<String, String> {
-        (0..n)
-            .into_iter()
-            .map(|i| (format!("k{i}"), format!("v{i}")))
-            .collect()
+        (0..n).map(|i| (format!("k{i}"), format!("v{i}"))).collect()
     }
 }
diff --git a/datafusion/common/src/scalar.rs b/datafusion/common/src/scalar.rs
index 905661541..66c1f3f12 100644
--- a/datafusion/common/src/scalar.rs
+++ b/datafusion/common/src/scalar.rs
@@ -1526,7 +1526,6 @@ impl ScalarValue {
             DataType::Dictionary(key_type, value_type) => {
                 // create the values array
                 let value_scalars = scalars
-                    .into_iter()
                     .map(|scalar| match scalar {
                         ScalarValue::Dictionary(inner_key_type, scalar) => {
                             if &inner_key_type == key_type {
@@ -1704,7 +1703,6 @@ impl ScalarValue {
     ) -> Decimal128Array {
         std::iter::repeat(value)
             .take(size)
-            .into_iter()
             .collect::<Decimal128Array>()
             .with_precision_and_scale(precision, scale)
             .unwrap()
diff --git a/datafusion/common/src/table_reference.rs 
b/datafusion/common/src/table_reference.rs
index 1e6292b29..4ca41edd9 100644
--- a/datafusion/common/src/table_reference.rs
+++ b/datafusion/common/src/table_reference.rs
@@ -200,7 +200,7 @@ impl<'a> TableReference<'a> {
     /// a single double quote in the identifier)
     pub fn parse_str(s: &'a str) -> Self {
         let mut parts = parse_identifiers(s)
-            .unwrap_or(vec![])
+            .unwrap_or_default()
             .into_iter()
             .map(|id| match id.quote_style {
                 Some(_) => id.value,
diff --git a/datafusion/core/src/physical_plan/empty.rs 
b/datafusion/core/src/physical_plan/empty.rs
index c3bcc5d2a..8a780af0f 100644
--- a/datafusion/core/src/physical_plan/empty.rs
+++ b/datafusion/core/src/physical_plan/empty.rs
@@ -74,14 +74,12 @@ impl EmptyExec {
             vec![RecordBatch::try_new(
                 Arc::new(Schema::new(
                     (0..n_field)
-                        .into_iter()
                         .map(|i| {
                             Field::new(format!("placeholder_{i}"), 
DataType::Null, true)
                         })
                         .collect(),
                 )),
                 (0..n_field)
-                    .into_iter()
                     .map(|_i| {
                         let ret: ArrayRef = Arc::new(NullArray::new(1));
                         ret
diff --git a/datafusion/core/src/physical_plan/sorts/sort.rs 
b/datafusion/core/src/physical_plan/sorts/sort.rs
index ad08504c3..e3263747f 100644
--- a/datafusion/core/src/physical_plan/sorts/sort.rs
+++ b/datafusion/core/src/physical_plan/sorts/sort.rs
@@ -295,7 +295,6 @@ fn in_mem_partial_sort(
         let (sorted_arrays, batches): (Vec<Vec<ArrayRef>>, Vec<RecordBatch>) =
             buffered_batches
                 .drain(..)
-                .into_iter()
                 .map(|b| {
                     let BatchWithSortArray {
                         sort_arrays,
diff --git a/datafusion/core/src/physical_plan/sorts/sort_preserving_merge.rs 
b/datafusion/core/src/physical_plan/sorts/sort_preserving_merge.rs
index a324bcc48..7ef4d3bf8 100644
--- a/datafusion/core/src/physical_plan/sorts/sort_preserving_merge.rs
+++ b/datafusion/core/src/physical_plan/sorts/sort_preserving_merge.rs
@@ -191,7 +191,6 @@ impl ExecutionPlan for SortPreservingMergeExec {
                 // Use tokio only if running from a tokio context (#2201)
                 let receivers = match tokio::runtime::Handle::try_current() {
                     Ok(_) => (0..input_partitions)
-                        .into_iter()
                         .map(|part_i| {
                             let (sender, receiver) = mpsc::channel(1);
                             let join_handle = spawn_execution(
@@ -355,10 +354,7 @@ impl SortPreservingMergeStream {
         batch_size: usize,
     ) -> Result<Self> {
         let stream_count = streams.len();
-        let batches = (0..stream_count)
-            .into_iter()
-            .map(|_| VecDeque::new())
-            .collect();
+        let batches = (0..stream_count).map(|_| VecDeque::new()).collect();
         tracking_metrics.init_mem_used(streams.iter().map(|s| 
s.mem_used).sum());
         let wrappers = streams.into_iter().map(|s| s.stream.fuse()).collect();
 
@@ -380,7 +376,7 @@ impl SortPreservingMergeStream {
             aborted: false,
             in_progress: vec![],
             next_batch_id: 0,
-            cursors: (0..stream_count).into_iter().map(|_| None).collect(),
+            cursors: (0..stream_count).map(|_| None).collect(),
             loser_tree: Vec::with_capacity(stream_count),
             loser_tree_adjusted: false,
             batch_size,
@@ -1060,7 +1056,6 @@ mod tests {
 
         // Split the sorted RecordBatch into multiple
         (0..batches)
-            .into_iter()
             .map(|batch_idx| {
                 let columns = (0..sorted.num_columns())
                     .map(|column_idx| {
diff --git a/datafusion/core/src/physical_plan/unnest.rs 
b/datafusion/core/src/physical_plan/unnest.rs
index 5ae80c8d7..d3d5abd9e 100644
--- a/datafusion/core/src/physical_plan/unnest.rs
+++ b/datafusion/core/src/physical_plan/unnest.rs
@@ -248,11 +248,9 @@ fn build_batch(
                 .unwrap();
             unnest_batch(batch, schema, column, list_array)
         }
-        _ => {
-            return Err(DataFusionError::Execution(format!(
-                "Invalid unnest column {column}"
-            )));
-        }
+        _ => Err(DataFusionError::Execution(format!(
+            "Invalid unnest column {column}"
+        ))),
     }
 }
 
diff --git 
a/datafusion/core/src/physical_plan/windows/bounded_window_agg_exec.rs 
b/datafusion/core/src/physical_plan/windows/bounded_window_agg_exec.rs
index 8ad88ffc3..0d929d135 100644
--- a/datafusion/core/src/physical_plan/windows/bounded_window_agg_exec.rs
+++ b/datafusion/core/src/physical_plan/windows/bounded_window_agg_exec.rs
@@ -518,7 +518,6 @@ impl SortedPartitionByBoundedWindowStream {
                 }
                 cur_window_expr_out_result_len
             })
-            .into_iter()
             .min()
             .unwrap_or(0)
     }
diff --git a/datafusion/physical-expr/src/aggregate/average.rs 
b/datafusion/physical-expr/src/aggregate/average.rs
index d755a4405..de5f78f0a 100644
--- a/datafusion/physical-expr/src/aggregate/average.rs
+++ b/datafusion/physical-expr/src/aggregate/average.rs
@@ -334,7 +334,6 @@ mod tests {
         let array: ArrayRef = Arc::new(
             std::iter::repeat::<Option<i128>>(None)
                 .take(6)
-                .into_iter()
                 .collect::<Decimal128Array>()
                 .with_precision_and_scale(10, 0)?,
         );
diff --git a/datafusion/physical-expr/src/aggregate/count_distinct.rs 
b/datafusion/physical-expr/src/aggregate/count_distinct.rs
index 87c0518d1..0f3c4c5b4 100644
--- a/datafusion/physical-expr/src/aggregate/count_distinct.rs
+++ b/datafusion/physical-expr/src/aggregate/count_distinct.rs
@@ -193,7 +193,6 @@ impl Accumulator for DistinctCountAccumulator {
                     "cols_out should only consist of ScalarValue::List. {t:?} 
is found"
                 ))),
             })
-            .into_iter()
             .collect::<Result<Vec<_>>>()?;
 
         self.values.iter().for_each(|distinct_values| {
diff --git a/datafusion/physical-expr/src/aggregate/min_max.rs 
b/datafusion/physical-expr/src/aggregate/min_max.rs
index bf4fd0868..711679a9d 100644
--- a/datafusion/physical-expr/src/aggregate/min_max.rs
+++ b/datafusion/physical-expr/src/aggregate/min_max.rs
@@ -943,7 +943,6 @@ mod tests {
         let array: ArrayRef = Arc::new(
             std::iter::repeat::<Option<i128>>(None)
                 .take(0)
-                .into_iter()
                 .collect::<Decimal128Array>()
                 .with_precision_and_scale(10, 0)?,
         );
@@ -971,7 +970,6 @@ mod tests {
         let array: ArrayRef = Arc::new(
             std::iter::repeat::<Option<i128>>(None)
                 .take(6)
-                .into_iter()
                 .collect::<Decimal128Array>()
                 .with_precision_and_scale(10, 0)?,
         );
@@ -1031,7 +1029,6 @@ mod tests {
         let array: ArrayRef = Arc::new(
             std::iter::repeat::<Option<i128>>(None)
                 .take(0)
-                .into_iter()
                 .collect::<Decimal128Array>()
                 .with_precision_and_scale(10, 0)?,
         );
@@ -1074,7 +1071,6 @@ mod tests {
         let array: ArrayRef = Arc::new(
             std::iter::repeat::<Option<i128>>(None)
                 .take(6)
-                .into_iter()
                 .collect::<Decimal128Array>()
                 .with_precision_and_scale(10, 0)?,
         );
diff --git a/datafusion/physical-expr/src/aggregate/sum.rs 
b/datafusion/physical-expr/src/aggregate/sum.rs
index 2f92aa939..0a21de22d 100644
--- a/datafusion/physical-expr/src/aggregate/sum.rs
+++ b/datafusion/physical-expr/src/aggregate/sum.rs
@@ -383,7 +383,6 @@ mod tests {
         let array: ArrayRef = Arc::new(
             std::iter::repeat::<Option<i128>>(None)
                 .take(6)
-                .into_iter()
                 .collect::<Decimal128Array>()
                 .with_precision_and_scale(10, 0)?,
         );
diff --git a/datafusion/physical-expr/src/expressions/binary.rs 
b/datafusion/physical-expr/src/expressions/binary.rs
index 479fe9315..ec9096ffc 100644
--- a/datafusion/physical-expr/src/expressions/binary.rs
+++ b/datafusion/physical-expr/src/expressions/binary.rs
@@ -3187,7 +3187,6 @@ mod tests {
         // build a left deep tree ((((a + a) + a) + a ....
         let tree_depth: i32 = 100;
         let expr = (0..tree_depth)
-            .into_iter()
             .map(|_| col("a", schema.as_ref()).unwrap())
             .reduce(|l, r| binary_simple(l, Operator::Plus, r, &schema))
             .unwrap();
diff --git a/datafusion/physical-expr/src/expressions/binary/kernels_arrow.rs 
b/datafusion/physical-expr/src/expressions/binary/kernels_arrow.rs
index 7bbce39a4..365a7de9b 100644
--- a/datafusion/physical-expr/src/expressions/binary/kernels_arrow.rs
+++ b/datafusion/physical-expr/src/expressions/binary/kernels_arrow.rs
@@ -134,7 +134,7 @@ pub(crate) fn is_not_distinct_from_null(
 }
 
 fn make_boolean_array(length: usize, value: bool) -> Result<BooleanArray> {
-    Ok((0..length).into_iter().map(|_| Some(value)).collect())
+    Ok((0..length).map(|_| Some(value)).collect())
 }
 
 pub(crate) fn is_not_distinct_from_utf8<OffsetSize: OffsetSizeTrait>(
diff --git a/datafusion/physical-expr/src/expressions/in_list.rs 
b/datafusion/physical-expr/src/expressions/in_list.rs
index fc4e102fe..3a5a25ff6 100644
--- a/datafusion/physical-expr/src/expressions/in_list.rs
+++ b/datafusion/physical-expr/src/expressions/in_list.rs
@@ -924,7 +924,7 @@ mod tests {
 
         // test the optimization: set
         // expression: "a in (99..300), the data type of list is INT32
-        let list = (99i32..300).into_iter().map(lit).collect::<Vec<_>>();
+        let list = (99i32..300).map(lit).collect::<Vec<_>>();
 
         in_list!(
             batch,
diff --git a/datafusion/physical-expr/src/window/nth_value.rs 
b/datafusion/physical-expr/src/window/nth_value.rs
index a1f03f13b..ef6e3c6d0 100644
--- a/datafusion/physical-expr/src/window/nth_value.rs
+++ b/datafusion/physical-expr/src/window/nth_value.rs
@@ -237,7 +237,6 @@ mod tests {
         let result = ranges
             .iter()
             .map(|range| evaluator.evaluate_inside_range(&values, range))
-            .into_iter()
             .collect::<Result<Vec<ScalarValue>>>()?;
         let result = ScalarValue::iter_to_array(result.into_iter())?;
         let result = as_int32_array(&result)?;
diff --git a/datafusion/substrait/src/logical_plan/consumer.rs 
b/datafusion/substrait/src/logical_plan/consumer.rs
index 1ae5568af..afb83058a 100644
--- a/datafusion/substrait/src/logical_plan/consumer.rs
+++ b/datafusion/substrait/src/logical_plan/consumer.rs
@@ -440,16 +440,14 @@ fn from_substrait_jointype(join_type: i32) -> 
Result<JoinType> {
             join_rel::JoinType::Outer => Ok(JoinType::Full),
             join_rel::JoinType::Anti => Ok(JoinType::LeftAnti),
             join_rel::JoinType::Semi => Ok(JoinType::LeftSemi),
-            _ => {
-                return Err(DataFusionError::Internal(format!(
-                    "unsupported join type {substrait_join_type:?}"
-                )))
-            }
+            _ => Err(DataFusionError::Internal(format!(
+                "unsupported join type {substrait_join_type:?}"
+            ))),
         }
     } else {
-        return Err(DataFusionError::Internal(format!(
+        Err(DataFusionError::Internal(format!(
             "invalid join type variant {join_type:?}"
-        )));
+        )))
     }
 }
 
@@ -671,12 +669,10 @@ pub async fn from_substrait_rex(
                 Some(LiteralType::Null(ntype)) => {
                     Ok(Arc::new(Expr::Literal(from_substrait_null(ntype)?)))
                 }
-                _ => {
-                    return Err(DataFusionError::NotImplemented(format!(
-                        "Unsupported literal_type: {:?}",
-                        lit.literal_type
-                    )))
-                }
+                _ => Err(DataFusionError::NotImplemented(format!(
+                    "Unsupported literal_type: {:?}",
+                    lit.literal_type
+                ))),
             }
         }
         _ => Err(DataFusionError::NotImplemented(

Reply via email to