Fix some of the clippy errors
This commit is contained in:
parent
e53650d02e
commit
8eec9c6759
6 changed files with 23 additions and 25 deletions
|
|
@ -41,7 +41,7 @@ impl Table {
|
|||
}
|
||||
|
||||
pub fn table_name(&self) -> &TableName {
|
||||
&self.schema.table_name()
|
||||
self.schema.table_name()
|
||||
}
|
||||
|
||||
// ======Selection======
|
||||
|
|
@ -69,18 +69,18 @@ impl Table {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn select_all_rows<'a>(&'a self, selected_columns: Vec<Column>) -> impl Iterator<Item=RestrictedRow> + 'a {
|
||||
pub fn select_all_rows(&self, selected_columns: Vec<Column>) -> impl Iterator<Item=RestrictedRow> + '_ {
|
||||
self.rows
|
||||
.values()
|
||||
.map(move |row| row.restrict_columns(&selected_columns))
|
||||
}
|
||||
|
||||
pub fn select_rows_where_eq<'a>(
|
||||
&'a self,
|
||||
pub fn select_rows_where_eq(
|
||||
&self,
|
||||
selected_columns: Vec<Column>,
|
||||
column: Column,
|
||||
value: Value,
|
||||
) -> DbResult<impl Iterator<Item=RestrictedRow> + 'a> {
|
||||
) -> DbResult<impl Iterator<Item=RestrictedRow> + '_> {
|
||||
let restrict_columns_of_row = move |row: Row| row.restrict_columns(&selected_columns);
|
||||
match value {
|
||||
Value::Indexable(value) => match self.fetch_ids_from_index(column, &value)? {
|
||||
|
|
@ -116,10 +116,7 @@ impl Table {
|
|||
}
|
||||
|
||||
for (column, column_index) in &mut self.indexes {
|
||||
match &row[*column] {
|
||||
Value::Indexable(val) => column_index.add(val.clone(), id),
|
||||
_ => {},
|
||||
}
|
||||
if let Value::Indexable(val) = &row[*column] { column_index.add(val.clone(), id) }
|
||||
}
|
||||
|
||||
let _ = self.rows.insert(id, row);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn db_schema<'a>(&'a self) -> DbSchema {
|
||||
pub fn db_schema(&self) -> DbSchema {
|
||||
let mut schema: DbSchema = Vec::new();
|
||||
for (table_name, &table_position) in &self.table_name_position_mapping {
|
||||
let table_schema = self.tables[table_position].schema();
|
||||
|
|
@ -64,11 +64,11 @@ impl State {
|
|||
schema
|
||||
}
|
||||
|
||||
fn table_at<'a>(&'a self, table_position: TablePosition) -> &'a Table {
|
||||
fn table_at(&self, table_position: TablePosition) -> &Table {
|
||||
&self.tables[table_position]
|
||||
}
|
||||
|
||||
fn table_at_mut<'a>(&'a mut self, table_position: TablePosition) -> &'a mut Table {
|
||||
fn table_at_mut(&mut self, table_position: TablePosition) -> &mut Table {
|
||||
&mut self.tables[table_position]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ impl RestrictedRow {
|
|||
self.0.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.is_empty()
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item=&(Column, Value)> {
|
||||
self.0.iter()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue