mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-18 14:35:14 +01:00
manual fixes based on clippy suggestions
This commit is contained in:
@@ -99,7 +99,7 @@ impl Table {
|
||||
pub fn get_column(&self, name: &str) -> Option<(usize, &Column)> {
|
||||
match self {
|
||||
Table::BTree(table) => table.get_column(name),
|
||||
Table::Index(index) => unimplemented!(),
|
||||
Table::Index(_) => unimplemented!(),
|
||||
Table::Pseudo(table) => table.get_column(name),
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ impl Table {
|
||||
pub fn get_column_at(&self, index: usize) -> &Column {
|
||||
match self {
|
||||
Table::BTree(table) => table.columns.get(index).unwrap(),
|
||||
Table::Index(index) => unimplemented!(),
|
||||
Table::Index(_) => unimplemented!(),
|
||||
Table::Pseudo(table) => table.columns.get(index).unwrap(),
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ impl Table {
|
||||
pub fn columns(&self) -> &Vec<Column> {
|
||||
match self {
|
||||
Table::BTree(table) => &table.columns,
|
||||
Table::Index(index) => unimplemented!(),
|
||||
Table::Index(_) => unimplemented!(),
|
||||
Table::Pseudo(table) => &table.columns,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,10 +403,10 @@ impl Emitter for Operator {
|
||||
.unwrap_or(m.termination_label_stack.last().unwrap());
|
||||
match cmp_op {
|
||||
ast::Operator::Equals | ast::Operator::LessEquals => {
|
||||
if index_cursor_id.is_some() {
|
||||
if let Some(index_cursor_id) = index_cursor_id {
|
||||
program.emit_insn_with_label_dependency(
|
||||
Insn::IdxGT {
|
||||
cursor_id: index_cursor_id.unwrap(),
|
||||
cursor_id: index_cursor_id,
|
||||
start_reg: cmp_reg,
|
||||
num_regs: 1,
|
||||
target_pc: abort_jump_target,
|
||||
@@ -430,10 +430,10 @@ impl Emitter for Operator {
|
||||
}
|
||||
}
|
||||
ast::Operator::Less => {
|
||||
if index_cursor_id.is_some() {
|
||||
if let Some(index_cursor_id) = index_cursor_id {
|
||||
program.emit_insn_with_label_dependency(
|
||||
Insn::IdxGE {
|
||||
cursor_id: index_cursor_id.unwrap(),
|
||||
cursor_id: index_cursor_id,
|
||||
start_reg: cmp_reg,
|
||||
num_regs: 1,
|
||||
target_pc: abort_jump_target,
|
||||
@@ -459,9 +459,9 @@ impl Emitter for Operator {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
if index_cursor_id.is_some() {
|
||||
if let Some(index_cursor_id) = index_cursor_id {
|
||||
program.emit_insn(Insn::DeferredSeek {
|
||||
index_cursor_id: index_cursor_id.unwrap(),
|
||||
index_cursor_id,
|
||||
table_cursor_id,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ pub fn optimize_plan(mut select_plan: Plan) -> Result<(Plan, ExpressionResultCac
|
||||
)?;
|
||||
eliminate_unnecessary_orderby(
|
||||
&mut select_plan.root_operator,
|
||||
&select_plan.referenced_tables,
|
||||
&select_plan.available_indexes,
|
||||
)?;
|
||||
find_shared_expressions_in_child_operators_and_mark_them_so_that_the_parent_operator_doesnt_recompute_them(&select_plan.root_operator, &mut expr_result_cache);
|
||||
@@ -85,7 +84,6 @@ fn _operator_is_already_ordered_by(
|
||||
|
||||
fn eliminate_unnecessary_orderby(
|
||||
operator: &mut Operator,
|
||||
referenced_tables: &Vec<BTreeTableReference>,
|
||||
available_indexes: &Vec<Rc<Index>>,
|
||||
) -> Result<()> {
|
||||
match operator {
|
||||
@@ -105,7 +103,7 @@ fn eliminate_unnecessary_orderby(
|
||||
Ok(())
|
||||
}
|
||||
Operator::Limit { source, .. } => {
|
||||
eliminate_unnecessary_orderby(source, referenced_tables, available_indexes)?;
|
||||
eliminate_unnecessary_orderby(source, available_indexes)?;
|
||||
Ok(())
|
||||
}
|
||||
_ => Ok(()),
|
||||
|
||||
@@ -534,10 +534,10 @@ pub fn insn_to_str(
|
||||
"".to_string(),
|
||||
),
|
||||
Insn::SeekGT {
|
||||
is_index,
|
||||
is_index: _,
|
||||
cursor_id,
|
||||
start_reg,
|
||||
num_regs,
|
||||
num_regs: _,
|
||||
target_pc,
|
||||
} => (
|
||||
"SeekGT",
|
||||
@@ -549,10 +549,10 @@ pub fn insn_to_str(
|
||||
"".to_string(),
|
||||
),
|
||||
Insn::SeekGE {
|
||||
is_index,
|
||||
is_index: _,
|
||||
cursor_id,
|
||||
start_reg,
|
||||
num_regs,
|
||||
num_regs: _,
|
||||
target_pc,
|
||||
} => (
|
||||
"SeekGE",
|
||||
@@ -566,7 +566,7 @@ pub fn insn_to_str(
|
||||
Insn::IdxGT {
|
||||
cursor_id,
|
||||
start_reg,
|
||||
num_regs,
|
||||
num_regs: _,
|
||||
target_pc,
|
||||
} => (
|
||||
"IdxGT",
|
||||
@@ -580,7 +580,7 @@ pub fn insn_to_str(
|
||||
Insn::IdxGE {
|
||||
cursor_id,
|
||||
start_reg,
|
||||
num_regs,
|
||||
num_regs: _,
|
||||
target_pc,
|
||||
} => (
|
||||
"IdxGE",
|
||||
|
||||
Reference in New Issue
Block a user