Fix clippy warnings

This commit is contained in:
gwenn 2018-05-13 19:16:12 +02:00
parent 370740b17f
commit 88a7ed5812
2 changed files with 8 additions and 10 deletions

View File

@ -215,10 +215,8 @@ impl VTab for CSVTab {
} else { } else {
let mut record = csv::ByteRecord::new(); let mut record = csv::ByteRecord::new();
if try!(reader.read_byte_record(&mut record)) { if try!(reader.read_byte_record(&mut record)) {
let mut count = 0; for (i, _) in record.iter().enumerate() {
for _ in record.iter() { cols.push(format!("c{}", i));
cols.push(format!("c{}", count));
count += 1;
} }
} }
} }
@ -249,7 +247,7 @@ impl VTab for CSVTab {
// Only a forward full table scan is supported. // Only a forward full table scan is supported.
fn best_index(&self, info: &mut IndexInfo) -> Result<()> { fn best_index(&self, info: &mut IndexInfo) -> Result<()> {
info.set_estimated_cost(1000000.); info.set_estimated_cost(1_000_000.);
Ok(()) Ok(())
} }

View File

@ -131,11 +131,11 @@ impl VTab for SeriesTab {
if idx_num.contains(QueryPlanFlags::BOTH) { if idx_num.contains(QueryPlanFlags::BOTH) {
// Both start= and stop= boundaries are available. // Both start= and stop= boundaries are available.
info.set_estimated_cost( info.set_estimated_cost(
(2 - if idx_num.contains(QueryPlanFlags::STEP) { f64::from(2 - if idx_num.contains(QueryPlanFlags::STEP) {
1 1
} else { } else {
0 0
}) as f64, }),
); );
info.set_estimated_rows(1000); info.set_estimated_rows(1000);
if info.num_of_order_by() == 1 { if info.num_of_order_by() == 1 {
@ -145,8 +145,8 @@ impl VTab for SeriesTab {
info.set_order_by_consumed(true); info.set_order_by_consumed(true);
} }
} else { } else {
info.set_estimated_cost(2147483647f64); info.set_estimated_cost(2_147_483_647f64);
info.set_estimated_rows(2147483647); info.set_estimated_rows(2_147_483_647);
} }
info.set_idx_num(idx_num.bits()); info.set_idx_num(idx_num.bits());
Ok(()) Ok(())
@ -201,7 +201,7 @@ impl VTabCursor for SeriesTabCursor {
self.max_value = try!(args.get(i)); self.max_value = try!(args.get(i));
i += 1; i += 1;
} else { } else {
self.max_value = 0xffffffff; self.max_value = 0xffff_ffff;
} }
if idx_num.contains(QueryPlanFlags::STEP) { if idx_num.contains(QueryPlanFlags::STEP) {
self.step = try!(args.get(i)); self.step = try!(args.get(i));