Merge 'cargo clippy --fix --allow-dirty && cargo fmt' from Jussi Saurio

Closes #325
This commit is contained in:
jussisaurio
2024-09-15 09:56:02 +03:00
13 changed files with 128 additions and 160 deletions

View File

@@ -107,7 +107,7 @@ fn rusqlite_bench(criterion: &mut Criterion) {
let conn = rusqlite::Connection::open("../testing/testing.db").unwrap();
conn.pragma_update(None, "locking_mode", &"EXCLUSIVE")
conn.pragma_update(None, "locking_mode", "EXCLUSIVE")
.unwrap();
group.bench_function("Prepare statement: 'SELECT 1'", |b| {
b.iter(|| {

View File

@@ -476,7 +476,7 @@ fn parse_hex(s: &str) -> Result<i32> {
}
fn is_hex_literal(s: &str) -> bool {
let trimmed = s.trim_start_matches(|c| c == '+' || c == '-');
let trimmed = s.trim_start_matches(['+', '-']);
trimmed.len() > 2 && (&trimmed[..2] == "0x" || &trimmed[..2] == "0X")
}

View File

@@ -38,7 +38,7 @@ impl Schema {
let table_name = normalize_ident(&index.table_name);
self.indexes
.entry(table_name)
.or_insert_with(Vec::new)
.or_default()
.push(index.clone())
}
}
@@ -451,7 +451,7 @@ impl Index {
Ok(Index {
name: index_name,
table_name: normalize_ident(&tbl_name.0),
root_page: root_page,
root_page,
columns: index_columns,
unique,
})

View File

@@ -378,7 +378,7 @@ impl BTreeCursor {
let mut page = page.contents.write().unwrap();
let page = page.as_mut().unwrap();
self.insert_into_cell(page, &cell_payload.as_slice(), cell_idx);
self.insert_into_cell(page, cell_payload.as_slice(), cell_idx);
page.overflow_cells.len()
};
@@ -434,8 +434,8 @@ impl BTreeCursor {
if page.first_freeblock() == 0 {
// insert into empty list
page.write_u16(offset as usize, 0);
page.write_u16(offset as usize + 2, len as u16);
page.write_u16(BTREE_HEADER_OFFSET_FREEBLOCK, offset as u16);
page.write_u16(offset as usize + 2, len);
page.write_u16(BTREE_HEADER_OFFSET_FREEBLOCK, offset);
return;
}
let first_block = page.first_freeblock();
@@ -443,8 +443,8 @@ impl BTreeCursor {
if offset < first_block {
// insert into head of list
page.write_u16(offset as usize, first_block);
page.write_u16(offset as usize + 2, len as u16);
page.write_u16(BTREE_HEADER_OFFSET_FREEBLOCK, offset as u16);
page.write_u16(offset as usize + 2, len);
page.write_u16(BTREE_HEADER_OFFSET_FREEBLOCK, offset);
return;
}
@@ -464,7 +464,7 @@ impl BTreeCursor {
let mut pc = first_block;
let mut prev = first_block;
while pc <= maxpc && pc < offset as u16 {
while pc <= maxpc && pc < offset {
let next = page.read_u16(pc as usize);
prev = pc;
pc = next;
@@ -595,7 +595,7 @@ impl BTreeCursor {
let is_leaf = page.is_leaf();
let page_type = page.page_type();
let mut new_pages = vec![page, right_page];
let new_pages_ids = vec![mem_page.page_idx, right_page_id];
let new_pages_ids = [mem_page.page_idx, right_page_id];
trace!(
"splitting left={} right={}",
new_pages_ids[0],
@@ -681,7 +681,7 @@ impl BTreeCursor {
let mut i = 0;
for cell_idx in current_cell_index..current_cell_index + cells_to_copy {
let cell = scratch_cells[cell_idx];
self.insert_into_cell(*page, cell, i);
self.insert_into_cell(page, cell, i);
i += 1;
}
divider_cells_index.push(current_cell_index + cells_to_copy - 1);
@@ -705,7 +705,7 @@ impl BTreeCursor {
BTreeCell::TableInteriorCell(interior) => interior._left_child_page,
_ => unreachable!(),
};
self.drop_cell(*page, page.cell_count() - 1);
self.drop_cell(page, page.cell_count() - 1);
page.write_u32(BTREE_HEADER_OFFSET_RIGHTMOST, last_cell_pointer);
}
// last page right most pointer points to previous right most pointer before splitting

View File

@@ -360,7 +360,7 @@ impl Pager {
}
for page_id in dirty_pages.iter() {
let mut cache = self.page_cache.borrow_mut();
let page = cache.get(&page_id).expect("we somehow added a page to dirty list but we didn't mark it as dirty, causing cache to drop it.");
let page = cache.get(page_id).expect("we somehow added a page to dirty list but we didn't mark it as dirty, causing cache to drop it.");
sqlite3_ondisk::begin_write_btree_page(self, &page)?;
}
dirty_pages.clear();

View File

@@ -439,7 +439,7 @@ impl PageContent {
let (overflows, to_read) =
payload_overflows(len_payload as usize, max_local, min_local, usable_size);
if overflows {
to_read as usize + n_payload + 4
to_read + n_payload + 4
} else {
len_payload as usize + n_payload + 4
}
@@ -1013,7 +1013,7 @@ pub fn payload_overflows(
if space_left > max_local {
space_left = min_local;
}
return (true, space_left + 4);
(true, space_left + 4)
}
#[cfg(test)]

View File

@@ -292,7 +292,7 @@ impl Emitter for Operator {
let jump_label = m
.next_row_labels
.get(id)
.unwrap_or(&m.termination_label_stack.last().unwrap());
.unwrap_or(m.termination_label_stack.last().unwrap());
program.emit_insn_with_label_dependency(
Insn::SeekRowid {
cursor_id,
@@ -361,7 +361,7 @@ impl Emitter for Operator {
.next_row_labels
.get(&right.id())
.or(m.next_row_labels.get(&left.id()))
.unwrap_or(&m.termination_label_stack.last().unwrap());
.unwrap_or(m.termination_label_stack.last().unwrap());
if *outer {
let lj_meta = m.left_joins.get(id).unwrap();
@@ -497,7 +497,7 @@ impl Emitter for Operator {
let mut order = Vec::new();
const ASCENDING: i64 = 0;
for _ in group_by.iter() {
order.push(OwnedValue::Integer(ASCENDING as i64));
order.push(OwnedValue::Integer(ASCENDING));
}
program.emit_insn(Insn::SorterOpen {
cursor_id: sort_cursor,
@@ -1170,9 +1170,7 @@ impl Emitter for Operator {
},
PROJECTION_FINALIZE_SOURCE => {
match source.step(program, m, referenced_tables)? {
OpStepResult::Done => {
return Ok(OpStepResult::Done);
}
OpStepResult::Done => Ok(OpStepResult::Done),
_ => unreachable!(),
}
}

View File

@@ -83,9 +83,8 @@ pub fn translate_condition_expr(
cursor_hint,
None,
);
match lhs.as_ref() {
ast::Expr::Literal(_) => program.mark_last_insn_constant(),
_ => {}
if let ast::Expr::Literal(_) = lhs.as_ref() {
program.mark_last_insn_constant()
}
let rhs_reg = program.alloc_register();
let _ = translate_expr(
@@ -96,9 +95,8 @@ pub fn translate_condition_expr(
cursor_hint,
None,
);
match rhs.as_ref() {
ast::Expr::Literal(_) => program.mark_last_insn_constant(),
_ => {}
if let ast::Expr::Literal(_) = rhs.as_ref() {
program.mark_last_insn_constant()
}
match op {
ast::Operator::Greater => {
@@ -515,26 +513,24 @@ pub fn translate_condition_expr(
condition_metadata.jump_target_when_false,
);
}
} else if condition_metadata.jump_if_condition_is_true {
program.emit_insn_with_label_dependency(
Insn::IfNot {
reg: cur_reg,
target_pc: condition_metadata.jump_target_when_true,
null_reg: cur_reg,
},
condition_metadata.jump_target_when_true,
);
} else {
if condition_metadata.jump_if_condition_is_true {
program.emit_insn_with_label_dependency(
Insn::IfNot {
reg: cur_reg,
target_pc: condition_metadata.jump_target_when_true,
null_reg: cur_reg,
},
condition_metadata.jump_target_when_true,
);
} else {
program.emit_insn_with_label_dependency(
Insn::If {
reg: cur_reg,
target_pc: condition_metadata.jump_target_when_false,
null_reg: cur_reg,
},
condition_metadata.jump_target_when_false,
);
}
program.emit_insn_with_label_dependency(
Insn::If {
reg: cur_reg,
target_pc: condition_metadata.jump_target_when_false,
null_reg: cur_reg,
},
condition_metadata.jump_target_when_false,
);
}
}
_ => todo!("op {:?} not implemented", expr),
@@ -971,9 +967,8 @@ pub fn translate_expr(
cursor_hint,
cached_results,
)?;
match arg {
ast::Expr::Literal(_) => program.mark_last_insn_constant(),
_ => {}
if let ast::Expr::Literal(_) = arg {
program.mark_last_insn_constant()
}
}
program.emit_insn(Insn::Function {
@@ -1210,7 +1205,7 @@ pub fn translate_expr(
}
ScalarFunc::Min => {
let args = if let Some(args) = args {
if args.len() < 1 {
if args.is_empty() {
crate::bail_parse_error!(
"min function with less than one argument"
);
@@ -1229,9 +1224,8 @@ pub fn translate_expr(
cursor_hint,
cached_results,
)?;
match arg {
ast::Expr::Literal(_) => program.mark_last_insn_constant(),
_ => {}
if let ast::Expr::Literal(_) = arg {
program.mark_last_insn_constant()
}
}
@@ -1245,7 +1239,7 @@ pub fn translate_expr(
}
ScalarFunc::Max => {
let args = if let Some(args) = args {
if args.len() < 1 {
if args.is_empty() {
crate::bail_parse_error!(
"max function with less than one argument"
);
@@ -1264,9 +1258,8 @@ pub fn translate_expr(
cursor_hint,
cached_results,
)?;
match arg {
ast::Expr::Literal(_) => program.mark_last_insn_constant(),
_ => {}
if let ast::Expr::Literal(_) = arg {
program.mark_last_insn_constant()
}
}
@@ -1530,7 +1523,7 @@ pub fn resolve_ident_table(
}) {
idx = res.0;
col_type = res.1.ty;
is_rowid_alias = catalog_table.column_is_rowid_alias(&res.1);
is_rowid_alias = catalog_table.column_is_rowid_alias(res.1);
}
}
let cursor_id = program.resolve_cursor_id(identifier, cursor_hint);
@@ -1564,7 +1557,7 @@ pub fn translate_table_columns(
) -> usize {
let mut cur_reg = start_reg;
for i in start_column_offset..table.columns().len() {
let is_rowid = table.column_is_rowid_alias(&table.get_column_at(i));
let is_rowid = table.column_is_rowid_alias(table.get_column_at(i));
let col_type = &table.get_column_at(i).ty;
if is_rowid {
program.emit_insn(Insn::RowId {

View File

@@ -81,7 +81,7 @@ fn use_indexes(
let predicates_owned = if fs.is_empty() {
None
} else {
Some(fs.drain(..).collect())
Some(std::mem::take(fs))
};
*operator = Operator::SeekRowid {
table: table.clone(),
@@ -93,39 +93,35 @@ fn use_indexes(
}
}
return Ok(());
Ok(())
}
Operator::Aggregate { source, .. } => {
use_indexes(source, referenced_tables)?;
return Ok(());
Ok(())
}
Operator::Filter { source, .. } => {
use_indexes(source, referenced_tables)?;
return Ok(());
}
Operator::SeekRowid { .. } => {
return Ok(());
Ok(())
}
Operator::SeekRowid { .. } => Ok(()),
Operator::Limit { source, .. } => {
use_indexes(source, referenced_tables)?;
return Ok(());
Ok(())
}
Operator::Join { left, right, .. } => {
use_indexes(left, referenced_tables)?;
use_indexes(right, referenced_tables)?;
return Ok(());
Ok(())
}
Operator::Order { source, .. } => {
use_indexes(source, referenced_tables)?;
return Ok(());
Ok(())
}
Operator::Projection { source, .. } => {
use_indexes(source, referenced_tables)?;
return Ok(());
}
Operator::Nothing => {
return Ok(());
Ok(())
}
Operator::Nothing => Ok(()),
}
}
@@ -161,7 +157,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
eliminate_constants(source)?;
}
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::Join {
left,
@@ -199,7 +195,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
}
}
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::Aggregate { source, .. } => {
if eliminate_constants(source)?
@@ -208,7 +204,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
*source = Box::new(Operator::Nothing);
}
// Aggregation operator can return a row even if the source is empty e.g. count(1) from users where 0
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::SeekRowid {
rowid_predicate,
@@ -233,7 +229,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
return Ok(ConstantConditionEliminationResult::ImpossibleCondition);
}
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::Limit { source, .. } => {
let constant_elimination_result = eliminate_constants(source)?;
@@ -242,7 +238,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
{
*operator = Operator::Nothing;
}
return Ok(constant_elimination_result);
Ok(constant_elimination_result)
}
Operator::Order { source, .. } => {
if eliminate_constants(source)?
@@ -251,7 +247,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
*operator = Operator::Nothing;
return Ok(ConstantConditionEliminationResult::ImpossibleCondition);
}
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::Projection { source, .. } => {
if eliminate_constants(source)?
@@ -261,7 +257,7 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
return Ok(ConstantConditionEliminationResult::ImpossibleCondition);
}
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::Scan { predicates, .. } => {
if let Some(ps) = predicates {
@@ -281,9 +277,9 @@ fn eliminate_constants(operator: &mut Operator) -> Result<ConstantConditionElimi
*predicates = None;
}
}
return Ok(ConstantConditionEliminationResult::Continue);
Ok(ConstantConditionEliminationResult::Continue)
}
Operator::Nothing => return Ok(ConstantConditionEliminationResult::Continue),
Operator::Nothing => Ok(ConstantConditionEliminationResult::Continue),
}
}
@@ -316,7 +312,7 @@ fn push_predicates(
*operator = source.take_ownership();
}
return Ok(());
Ok(())
}
Operator::Join {
left,
@@ -362,34 +358,28 @@ fn push_predicates(
i += 1;
}
return Ok(());
Ok(())
}
Operator::Aggregate { source, .. } => {
push_predicates(source, referenced_tables)?;
return Ok(());
}
Operator::SeekRowid { .. } => {
return Ok(());
Ok(())
}
Operator::SeekRowid { .. } => Ok(()),
Operator::Limit { source, .. } => {
push_predicates(source, referenced_tables)?;
return Ok(());
Ok(())
}
Operator::Order { source, .. } => {
push_predicates(source, referenced_tables)?;
return Ok(());
Ok(())
}
Operator::Projection { source, .. } => {
push_predicates(source, referenced_tables)?;
return Ok(());
}
Operator::Scan { .. } => {
return Ok(());
}
Operator::Nothing => {
return Ok(());
Ok(())
}
Operator::Scan { .. } => Ok(()),
Operator::Nothing => Ok(()),
}
}
@@ -432,7 +422,7 @@ fn push_predicate(
predicates.as_mut().unwrap().push(predicate);
}
return Ok(None);
Ok(None)
}
Operator::Filter {
source,
@@ -446,7 +436,7 @@ fn push_predicate(
ps.push(push_result.unwrap());
return Ok(None);
Ok(None)
}
Operator::Join {
left,
@@ -486,7 +476,7 @@ fn push_predicate(
join_on_preds.as_mut().unwrap().push(pred);
}
return Ok(None);
Ok(None)
}
Operator::Aggregate { source, .. } => {
let push_result = push_predicate(source, predicate, referenced_tables)?;
@@ -494,18 +484,16 @@ fn push_predicate(
return Ok(None);
}
return Ok(Some(push_result.unwrap()));
}
Operator::SeekRowid { .. } => {
return Ok(Some(predicate));
Ok(Some(push_result.unwrap()))
}
Operator::SeekRowid { .. } => Ok(Some(predicate)),
Operator::Limit { source, .. } => {
let push_result = push_predicate(source, predicate, referenced_tables)?;
if push_result.is_none() {
return Ok(None);
}
return Ok(Some(push_result.unwrap()));
Ok(Some(push_result.unwrap()))
}
Operator::Order { source, .. } => {
let push_result = push_predicate(source, predicate, referenced_tables)?;
@@ -513,7 +501,7 @@ fn push_predicate(
return Ok(None);
}
return Ok(Some(push_result.unwrap()));
Ok(Some(push_result.unwrap()))
}
Operator::Projection { source, .. } => {
let push_result = push_predicate(source, predicate, referenced_tables)?;
@@ -521,11 +509,9 @@ fn push_predicate(
return Ok(None);
}
return Ok(Some(push_result.unwrap()));
}
Operator::Nothing => {
return Ok(Some(predicate));
Ok(Some(push_result.unwrap()))
}
Operator::Nothing => Ok(Some(predicate)),
}
}
@@ -596,7 +582,7 @@ impl ExpressionResultCache {
result_column_idx: usize,
child_operator_id: usize,
child_operator_result_column_idx_mask: usize,
) -> () {
) {
let key = operator_id * OPERATOR_ID_MULTIPLIER + result_column_idx;
let mut values = Vec::new();
@@ -849,8 +835,6 @@ fn find_shared_expressions_in_child_operators_and_mark_them_so_that_the_parent_o
match operator {
Operator::Aggregate {
source,
aggregates,
group_by,
..
} => {
find_shared_expressions_in_child_operators_and_mark_them_so_that_the_parent_operator_doesnt_recompute_them(
@@ -867,7 +851,7 @@ fn find_shared_expressions_in_child_operators_and_mark_them_so_that_the_parent_o
let mut idx = 0;
for (expr, _) in key.iter() {
let result = find_indexes_of_all_result_columns_in_operator_that_match_expr_either_fully_or_partially(&expr, source);
let result = find_indexes_of_all_result_columns_in_operator_that_match_expr_either_fully_or_partially(expr, source);
if result != 0 {
expr_result_cache.set_precomputation_key(
operator.id(),
@@ -883,19 +867,16 @@ fn find_shared_expressions_in_child_operators_and_mark_them_so_that_the_parent_o
Operator::Projection { source, expressions, .. } => {
let mut idx = 0;
for expr in expressions.iter() {
match expr {
ProjectionColumn::Column(expr) => {
let result = find_indexes_of_all_result_columns_in_operator_that_match_expr_either_fully_or_partially(&expr, source);
if result != 0 {
expr_result_cache.set_precomputation_key(
operator.id(),
idx,
source.id(),
result,
);
}
if let ProjectionColumn::Column(expr) = expr {
let result = find_indexes_of_all_result_columns_in_operator_that_match_expr_either_fully_or_partially(expr, source);
if result != 0 {
expr_result_cache.set_precomputation_key(
operator.id(),
idx,
source.id(),
result,
);
}
_ => {}
}
idx += 1;
}

View File

@@ -40,20 +40,21 @@ fn resolve_aggregates(expr: &ast::Expr, aggs: &mut Vec<Aggregate>) {
_ => {
if let Some(args) = args {
for arg in args.iter() {
resolve_aggregates(&arg, aggs);
resolve_aggregates(arg, aggs);
}
}
}
}
}
ast::Expr::FunctionCallStar { name, .. } => {
match Func::resolve_function(normalize_ident(name.0.as_str()).as_str(), 0) {
Ok(Func::Agg(f)) => aggs.push(Aggregate {
if let Ok(Func::Agg(f)) =
Func::resolve_function(normalize_ident(name.0.as_str()).as_str(), 0)
{
aggs.push(Aggregate {
func: f,
args: vec![],
original_expr: expr.clone(),
}),
_ => {}
})
}
}
ast::Expr::Binary(lhs, _, rhs) => {
@@ -155,18 +156,15 @@ pub fn prepare_select_plan<'a>(schema: &Schema, select: ast::Select) -> Result<P
}
}
ast::Expr::FunctionCallStar { name, filter_over } => {
match Func::resolve_function(
if let Ok(Func::Agg(f)) = Func::resolve_function(
normalize_ident(name.0.as_str()).as_str(),
0,
) {
Ok(Func::Agg(f)) => {
aggregate_expressions.push(Aggregate {
func: f,
args: vec![],
original_expr: expr.clone(),
});
}
_ => {}
aggregate_expressions.push(Aggregate {
func: f,
args: vec![],
original_expr: expr.clone(),
});
}
}
ast::Expr::Binary(lhs, _, rhs) => {
@@ -276,13 +274,13 @@ pub fn prepare_select_plan<'a>(schema: &Schema, select: ast::Select) -> Result<P
}
// Return the unoptimized query plan
return Ok(Plan {
Ok(Plan {
root_operator: operator,
referenced_tables,
});
})
}
_ => todo!(),
};
}
}
fn parse_from(
@@ -336,7 +334,7 @@ fn parse_from(
}
}
return Ok((operator, tables));
Ok((operator, tables))
}
fn parse_join(
@@ -374,10 +372,8 @@ fn parse_join(
ast::JoinOperator::TypedJoin(Some(join_type)) => {
if join_type == JoinType::LEFT | JoinType::OUTER {
true
} else if join_type == JoinType::RIGHT | JoinType::OUTER {
true
} else {
false
join_type == JoinType::RIGHT | JoinType::OUTER
}
}
_ => false,

View File

@@ -120,7 +120,7 @@ pub fn exec_unixepoch(time_value: &OwnedValue) -> Result<String> {
}
fn get_unixepoch_from_naive_datetime(value: NaiveDateTime) -> String {
return value.and_utc().timestamp().to_string();
value.and_utc().timestamp().to_string()
}
fn parse_naive_date_time(time_value: &OwnedValue) -> Option<NaiveDateTime> {

View File

@@ -1002,7 +1002,7 @@ impl Program {
return_reg,
} => {
assert!(*target_pc >= 0);
state.registers[*return_reg] = OwnedValue::Integer(state.pc as i64 + 1);
state.registers[*return_reg] = OwnedValue::Integer(state.pc + 1);
state.pc = *target_pc;
}
Insn::Return { return_reg } => {
@@ -1809,7 +1809,7 @@ fn exec_length(reg: &OwnedValue) -> OwnedValue {
OwnedValue::Integer(reg.to_string().len() as i64)
}
OwnedValue::Blob(blob) => OwnedValue::Integer(blob.len() as i64),
OwnedValue::Agg(aggctx) => exec_length(&aggctx.final_value()),
OwnedValue::Agg(aggctx) => exec_length(aggctx.final_value()),
_ => reg.to_owned(),
}
}
@@ -2131,15 +2131,15 @@ mod tests {
impl Cursor for MockCursor {
fn seek_to_last(&mut self) -> Result<CursorResult<()>> {
return self.seek_to_last();
self.seek_to_last()
}
fn rowid(&self) -> Result<Option<u64>> {
return self.rowid();
self.rowid()
}
fn seek_rowid(&mut self, rowid: u64) -> Result<CursorResult<bool>> {
return self.seek_rowid(rowid);
self.seek_rowid(rowid)
}
fn rewind(&mut self) -> Result<CursorResult<()>> {

View File

@@ -27,8 +27,8 @@ impl TempDatabase {
pub fn connect_limbo(&self) -> limbo_core::Connection {
let db = Database::open_file(self.io.clone(), self.path.to_str().unwrap()).unwrap();
let conn = db.connect();
conn
db.connect()
}
}
@@ -106,7 +106,7 @@ mod tests {
let mut huge_text = String::new();
for i in 0..8192 {
huge_text.push(('A' as u8 + (i % 24) as u8) as char);
huge_text.push((b'A' + (i % 24) as u8) as char);
}
let list_query = "SELECT * FROM test LIMIT 1";
@@ -169,13 +169,13 @@ mod tests {
let _ = env_logger::try_init();
let tmp_db = TempDatabase::new("CREATE TABLE test (x INTEGER PRIMARY KEY, t TEXT);");
let conn = tmp_db.connect_limbo();
let iterations = 10 as usize;
let iterations = 10_usize;
let mut huge_texts = Vec::new();
for i in 0..iterations {
let mut huge_text = String::new();
for j in 0..8192 {
huge_text.push(('A' as u8 + i as u8) as char);
huge_text.push((b'A' + i as u8) as char);
}
huge_texts.push(huge_text);
}
@@ -219,7 +219,7 @@ mod tests {
};
let huge_text = &huge_texts[current_index];
assert_eq!(current_index, id as usize);
compare_string(&huge_text, text);
compare_string(huge_text, text);
current_index += 1;
}
RowResult::IO => {