mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-10 10:44:22 +01:00
cargo clippy --fix
This commit is contained in:
@@ -70,7 +70,7 @@ impl Cursor {
|
||||
Ok(CursorResult::Ok(()))
|
||||
}
|
||||
CursorResult::IO => {
|
||||
return Ok(CursorResult::IO);
|
||||
Ok(CursorResult::IO)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ impl Cursor {
|
||||
Ok(CursorResult::Ok(()))
|
||||
}
|
||||
CursorResult::IO => {
|
||||
return Ok(CursorResult::IO);
|
||||
Ok(CursorResult::IO)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ impl Completion {
|
||||
Self { buf, complete }
|
||||
}
|
||||
|
||||
pub fn buf<'a>(&'a self) -> Ref<'a, Buffer> {
|
||||
pub fn buf(&self) -> Ref<'_, Buffer> {
|
||||
self.buf.borrow()
|
||||
}
|
||||
|
||||
pub fn buf_mut<'a>(&'a self) -> RefMut<'a, Buffer> {
|
||||
pub fn buf_mut(&self) -> RefMut<'_, Buffer> {
|
||||
self.buf.borrow_mut()
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ impl Table {
|
||||
}
|
||||
sql.push_str(" ");
|
||||
sql.push_str(&column.name);
|
||||
sql.push_str(" ");
|
||||
sql.push(' ');
|
||||
sql.push_str(&column.ty.to_string());
|
||||
}
|
||||
sql.push_str(");\n");
|
||||
|
||||
@@ -327,7 +327,7 @@ pub fn read_value(buf: &[u8], serial_type: &SerialType) -> Result<(OwnedValue, u
|
||||
match *serial_type {
|
||||
SerialType::Null => Ok((OwnedValue::Null, 0)),
|
||||
SerialType::UInt8 => {
|
||||
if buf.len() < 1 {
|
||||
if buf.is_empty() {
|
||||
return Err(anyhow!("Invalid UInt8 value"));
|
||||
}
|
||||
Ok((OwnedValue::Integer(buf[0] as i64), 1))
|
||||
@@ -508,7 +508,7 @@ mod tests {
|
||||
#[case(&[0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x01], (567382630219905, 8))]
|
||||
#[case(&[0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x01], (145249953336295681, 9))]
|
||||
fn read_varint_test(#[case] input: &[u8], #[case] expected: (u64, usize)) {
|
||||
let result = read_varint(&input).unwrap();
|
||||
let result = read_varint(input).unwrap();
|
||||
assert_eq!(result, expected);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,7 @@ fn translate_select(schema: &Schema, select: Select) -> Result<Program> {
|
||||
program.emit_insn(Insn::OpenReadAwait);
|
||||
program.emit_insn(Insn::RewindAsync { cursor_id });
|
||||
let rewind_await_offset = program.emit_placeholder();
|
||||
let limit_decr_insn = match limit_reg {
|
||||
Some(_) => Some(program.emit_placeholder()),
|
||||
None => None,
|
||||
};
|
||||
let limit_decr_insn = limit_reg.map(|_| program.emit_placeholder());
|
||||
let (register_start, register_end) =
|
||||
translate_columns(&mut program, Some(cursor_id), Some(table), columns);
|
||||
program.emit_insn(Insn::ResultRow {
|
||||
|
||||
@@ -18,7 +18,7 @@ pub enum OwnedValue {
|
||||
Blob(Vec<u8>),
|
||||
}
|
||||
|
||||
pub fn to_value<'a>(value: &'a OwnedValue) -> Value<'a> {
|
||||
pub fn to_value(value: &OwnedValue) -> Value<'_> {
|
||||
match value {
|
||||
OwnedValue::Null => Value::Null,
|
||||
OwnedValue::Integer(i) => Value::Integer(*i),
|
||||
|
||||
Reference in New Issue
Block a user