Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Dec 31, 2023
1 parent 3b8a7ad commit 2958714
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions datafusion/expr/src/tree_node/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ impl TreeNode for Expr {
}
}
Expr::GroupingSet(GroupingSet::Rollup(exprs))
| Expr::GroupingSet(GroupingSet::Cube(exprs)) => exprs.into_iter().map(Cow::Borrowed).collect(),
Expr::ScalarFunction(ScalarFunction { args, .. }) => args.into_iter().map(Cow::Borrowed).collect(),
| Expr::GroupingSet(GroupingSet::Cube(exprs)) => exprs.iter().map(Cow::Borrowed).collect(),
Expr::ScalarFunction(ScalarFunction { args, .. }) => args.iter().map(Cow::Borrowed).collect(),
Expr::GroupingSet(GroupingSet::GroupingSets(lists_of_exprs)) => {
lists_of_exprs.into_iter().flatten().map(Cow::Borrowed).collect()
lists_of_exprs.iter().flatten().map(Cow::Borrowed).collect()
}
Expr::Column(_)
// Treat OuterReferenceColumn as a leaf expression
Expand Down Expand Up @@ -109,13 +109,13 @@ impl TreeNode for Expr {
order_by,
..
}) => {
let mut expr_vec: Vec<_> = args.into_iter().map(Cow::Borrowed).collect();
let mut expr_vec: Vec<_> = args.iter().map(Cow::Borrowed).collect();

if let Some(f) = filter {
expr_vec.push(Cow::Borrowed(f));
}
if let Some(o) = order_by {
expr_vec.extend(o.into_iter().map(Cow::Borrowed).collect::<Vec<_>>());
expr_vec.extend(o.iter().map(Cow::Borrowed).collect::<Vec<_>>());
}

expr_vec
Expand All @@ -126,14 +126,14 @@ impl TreeNode for Expr {
order_by,
..
}) => {
let mut expr_vec: Vec<_> = args.into_iter().map(Cow::Borrowed).collect();
expr_vec.extend(partition_by.into_iter().map(Cow::Borrowed).collect::<Vec<_>>());
expr_vec.extend(order_by.into_iter().map(Cow::Borrowed).collect::<Vec<_>>());
let mut expr_vec: Vec<_> = args.iter().map(Cow::Borrowed).collect();
expr_vec.extend(partition_by.iter().map(Cow::Borrowed).collect::<Vec<_>>());
expr_vec.extend(order_by.iter().map(Cow::Borrowed).collect::<Vec<_>>());
expr_vec
}
Expr::InList(InList { expr, list, .. }) => {
let mut expr_vec = vec![Cow::Borrowed(expr.as_ref())];
expr_vec.extend(list.into_iter().map(Cow::Borrowed).collect::<Vec<_>>());
expr_vec.extend(list.iter().map(Cow::Borrowed).collect::<Vec<_>>());
expr_vec
}
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<T> ExprTreeNode<T> {

impl<T: Clone> TreeNode for ExprTreeNode<T> {
fn children_nodes(&self) -> Vec<Cow<Self>> {
self.children().into_iter().map(Cow::Borrowed).collect()
self.children().iter().map(Cow::Borrowed).collect()
}

fn map_children<F>(mut self, transform: F) -> Result<Self>
Expand Down

0 comments on commit 2958714

Please sign in to comment.