Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
two clippy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wangpatrick57 committed Feb 11, 2024
1 parent 5c2fd60 commit c82f078
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
14 changes: 5 additions & 9 deletions optd-core/src/cascades/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,10 @@ impl<T: RelNodeTyp> Memo<T> {
group_id: ReducedGroupId,
memo_node: RelMemoNode<T>,
) {
match self.groups.entry(group_id) {
Entry::Occupied(mut entry) => {
let group = entry.get_mut();
group.group_exprs.insert(expr_id);
return;
}
_ => {}
if let Entry::Occupied(mut entry) = self.groups.entry(group_id) {
let group = entry.get_mut();
group.group_exprs.insert(expr_id);
return;
}
let mut group = Group {
group_exprs: HashSet::new(),
Expand Down Expand Up @@ -423,8 +420,7 @@ impl<T: RelNodeTyp> Memo<T> {
if !winner.impossible {
let expr_id = winner.expr_id;
let expr = self.get_expr_memoed(expr_id);
let mut children = Vec::new();
children.reserve(expr.children.len());
let mut children = Vec::with_capacity(expr.children.len());
for child in &expr.children {
children.push(self.get_best_group_binding(*child, on_produce)?);
}
Expand Down
3 changes: 1 addition & 2 deletions optd-core/src/cascades/tasks/optimize_inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ impl OptimizeInputsTask {
optimizer: &mut CascadesOptimizer<T>,
) -> Vec<Cost> {
let zero_cost = optimizer.cost().zero();
let mut input_cost = Vec::new();
input_cost.reserve(children.len());
let mut input_cost = Vec::with_capacity(children.len());
for &child in children.iter() {
let group = optimizer.get_group_info(child);
if let Some(ref winner) = group.winner {
Expand Down
4 changes: 4 additions & 0 deletions optd-datafusion-repr/src/properties/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ impl Schema {
pub fn len(&self) -> usize {
self.0.len()
}

pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

pub trait Catalog: Send + Sync + 'static {
Expand Down

0 comments on commit c82f078

Please sign in to comment.