From daf5863932d18708cecf0b9a85aeca5df83530f1 Mon Sep 17 00:00:00 2001 From: jussisaurio Date: Sun, 13 Oct 2024 12:19:04 +0300 Subject: [PATCH] manual fixes based on clippy suggestions --- core/schema.rs | 6 +++--- core/translate/emitter.rs | 12 ++++++------ core/translate/optimizer.rs | 4 +--- core/vdbe/explain.rs | 12 ++++++------ 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/core/schema.rs b/core/schema.rs index 6a440ffa8..7ebe249be 100644 --- a/core/schema.rs +++ b/core/schema.rs @@ -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 { match self { Table::BTree(table) => &table.columns, - Table::Index(index) => unimplemented!(), + Table::Index(_) => unimplemented!(), Table::Pseudo(table) => &table.columns, } } diff --git a/core/translate/emitter.rs b/core/translate/emitter.rs index 3d7cd87a6..9c18e8cde 100644 --- a/core/translate/emitter.rs +++ b/core/translate/emitter.rs @@ -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, }); } diff --git a/core/translate/optimizer.rs b/core/translate/optimizer.rs index ef7550162..c620907a5 100644 --- a/core/translate/optimizer.rs +++ b/core/translate/optimizer.rs @@ -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, available_indexes: &Vec>, ) -> 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(()), diff --git a/core/vdbe/explain.rs b/core/vdbe/explain.rs index 669c159b0..de918398a 100644 --- a/core/vdbe/explain.rs +++ b/core/vdbe/explain.rs @@ -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",