mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
clippy
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{collections::VecDeque, rc::Rc};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use crate::{types::OwnedValue, vdbe::Register};
|
||||
|
||||
@@ -283,8 +283,6 @@ pub fn jsonb_insert(args: &[Register], json_cache: &JsonCacheCell) -> crate::Res
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::types::Text;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -22,7 +22,6 @@ use jsonb::{ElementType, Jsonb, JsonbHeader, PathOperationMode, SearchOperation,
|
||||
use ser::to_string_pretty;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||
|
||||
@@ -7,8 +7,7 @@ use crate::storage::sqlite3_ondisk::{
|
||||
use crate::MvCursor;
|
||||
|
||||
use crate::types::{
|
||||
compare_immutable, compare_immutable_to_record, CursorResult, ImmutableRecord, OwnedValue,
|
||||
RefValue, SeekKey, SeekOp,
|
||||
compare_immutable, CursorResult, ImmutableRecord, OwnedValue, RefValue, SeekKey, SeekOp,
|
||||
};
|
||||
use crate::{return_corrupt, LimboError, Result};
|
||||
|
||||
@@ -329,7 +328,7 @@ impl BTreeCursor {
|
||||
|
||||
/// Move the cursor to the previous record and return it.
|
||||
/// Used in backwards iteration.
|
||||
fn get_prev_record(&mut self) -> Result<CursorResult<(Option<u64>)>> {
|
||||
fn get_prev_record(&mut self) -> Result<CursorResult<Option<u64>>> {
|
||||
loop {
|
||||
let page = self.stack.top();
|
||||
let cell_idx = self.stack.current_cell_index();
|
||||
@@ -346,7 +345,7 @@ impl BTreeCursor {
|
||||
self.stack.pop();
|
||||
} else {
|
||||
// moved to begin of btree
|
||||
return Ok(CursorResult::Ok((None)));
|
||||
return Ok(CursorResult::Ok(None));
|
||||
}
|
||||
}
|
||||
// continue to next loop to get record from the new page
|
||||
@@ -398,7 +397,7 @@ impl BTreeCursor {
|
||||
first_overflow_page,
|
||||
payload_size,
|
||||
}) => {
|
||||
let record = if let Some(next_page) = first_overflow_page {
|
||||
if let Some(next_page) = first_overflow_page {
|
||||
return_if_io!(self.process_overflow_read(_payload, next_page, payload_size))
|
||||
} else {
|
||||
crate::storage::sqlite3_ondisk::read_record(
|
||||
@@ -583,7 +582,7 @@ impl BTreeCursor {
|
||||
payload_size,
|
||||
}) => {
|
||||
assert!(predicate.is_none());
|
||||
let record = if let Some(next_page) = first_overflow_page {
|
||||
if let Some(next_page) = first_overflow_page {
|
||||
return_if_io!(self.process_overflow_read(
|
||||
_payload,
|
||||
*next_page,
|
||||
@@ -609,7 +608,7 @@ impl BTreeCursor {
|
||||
self.stack.push(mem_page);
|
||||
continue;
|
||||
}
|
||||
let record = if let Some(next_page) = first_overflow_page {
|
||||
if let Some(next_page) = first_overflow_page {
|
||||
return_if_io!(self.process_overflow_read(
|
||||
payload,
|
||||
*next_page,
|
||||
@@ -662,7 +661,7 @@ impl BTreeCursor {
|
||||
first_overflow_page,
|
||||
payload_size,
|
||||
}) => {
|
||||
let record = if let Some(next_page) = first_overflow_page {
|
||||
if let Some(next_page) = first_overflow_page {
|
||||
return_if_io!(self.process_overflow_read(
|
||||
payload,
|
||||
*next_page,
|
||||
@@ -754,7 +753,7 @@ impl BTreeCursor {
|
||||
SeekOp::EQ => *cell_rowid == rowid_key,
|
||||
};
|
||||
if found {
|
||||
let record = if let Some(next_page) = first_overflow_page {
|
||||
if let Some(next_page) = first_overflow_page {
|
||||
return_if_io!(self.process_overflow_read(
|
||||
payload,
|
||||
*next_page,
|
||||
|
||||
@@ -1081,10 +1081,6 @@ impl<T: Default + Copy> SmallVec<T> {
|
||||
self.len += 1;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_extra_data(&self) -> bool {
|
||||
self.len >= self.data.len()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_record(payload: &[u8], reuse_immutable: &mut ImmutableRecord) -> Result<()> {
|
||||
|
||||
@@ -4,15 +4,12 @@ use crate::error::LimboError;
|
||||
use crate::ext::{ExtValue, ExtValueType};
|
||||
use crate::pseudo::PseudoCursor;
|
||||
use crate::storage::btree::BTreeCursor;
|
||||
use crate::storage::buffer_pool;
|
||||
use crate::storage::sqlite3_ondisk::write_varint;
|
||||
use crate::vdbe::sorter::Sorter;
|
||||
use crate::vdbe::{Register, VTabOpaqueCursor};
|
||||
use crate::Result;
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt::Display;
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
|
||||
const MAX_REAL_SIZE: u8 = 15;
|
||||
|
||||
@@ -1327,7 +1324,6 @@ impl RawSlice {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[test]
|
||||
fn test_serialize_null() {
|
||||
|
||||
@@ -4548,6 +4548,15 @@ impl Row {
|
||||
T::from_value(value)
|
||||
}
|
||||
|
||||
pub fn get_value<'a>(&'a self, idx: usize) -> &'a OwnedValue {
|
||||
let value = unsafe { self.values.add(idx).as_ref().unwrap() };
|
||||
let value = match value {
|
||||
Register::OwnedValue(owned_value) => owned_value,
|
||||
_ => unreachable!("a row should be formed of values only"),
|
||||
};
|
||||
value
|
||||
}
|
||||
|
||||
pub fn get_values(&self) -> impl Iterator<Item = &OwnedValue> {
|
||||
let values = unsafe { std::slice::from_raw_parts(self.values, self.count) };
|
||||
// This should be ownedvalues
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::types::{ImmutableRecord, Record};
|
||||
use crate::types::ImmutableRecord;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
pub struct Sorter {
|
||||
|
||||
Reference in New Issue
Block a user