cargo clippy --fix

This commit is contained in:
Pekka Enberg
2024-01-28 10:21:38 +02:00
parent 9f733b5a73
commit 2c55cc797d
6 changed files with 9 additions and 12 deletions

View File

@@ -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)
}
}
}

View File

@@ -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()
}

View File

@@ -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");

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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),