mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-01 22:34:22 +01:00
Makes clippy happy
This commit is contained in:
@@ -348,13 +348,13 @@ fn py_to_db_value(obj: &Bound<PyAny>) -> Result<turso_core::Value> {
|
||||
if obj.is_none() {
|
||||
Ok(Value::Null)
|
||||
} else if let Ok(integer) = obj.extract::<i64>() {
|
||||
return Ok(Value::Integer(integer));
|
||||
Ok(Value::Integer(integer))
|
||||
} else if let Ok(float) = obj.extract::<f64>() {
|
||||
return Ok(Value::Float(float));
|
||||
Ok(Value::Float(float))
|
||||
} else if let Ok(string) = obj.extract::<String>() {
|
||||
return Ok(Value::Text(string.into()));
|
||||
Ok(Value::Text(string.into()))
|
||||
} else if let Ok(bytes) = obj.downcast::<PyBytes>() {
|
||||
return Ok(Value::Blob(bytes.as_bytes().to_vec()));
|
||||
Ok(Value::Blob(bytes.as_bytes().to_vec()))
|
||||
} else {
|
||||
return Err(PyErr::new::<ProgrammingError, _>(format!(
|
||||
"Unsupported Python type: {}",
|
||||
|
||||
@@ -1107,8 +1107,7 @@ impl Limbo {
|
||||
match table_name {
|
||||
"sqlite_master" | "sqlite_schema" | "sqlite_temp_master" | "sqlite_temp_schema" => {
|
||||
let schema = format!(
|
||||
"CREATE TABLE {} (\n type text,\n name text,\n tbl_name text,\n rootpage integer,\n sql text\n);",
|
||||
table_name
|
||||
"CREATE TABLE {table_name} (\n type text,\n name text,\n tbl_name text,\n rootpage integer,\n sql text\n);",
|
||||
);
|
||||
let _ = self.writeln(&schema);
|
||||
return Ok(true);
|
||||
|
||||
@@ -1551,7 +1551,7 @@ impl<'a> Parser<'a> {
|
||||
b"false" => {
|
||||
Ok(Box::new(Expr::Literal(Literal::Numeric("0".into()))))
|
||||
}
|
||||
_ => return Ok(Box::new(Expr::Id(Name::Ident(s)))),
|
||||
_ => Ok(Box::new(Expr::Id(Name::Ident(s)))),
|
||||
})
|
||||
}
|
||||
_ => Ok(Box::new(Expr::Id(name))),
|
||||
|
||||
@@ -410,15 +410,14 @@ fn perform_work(
|
||||
drop(stmt_borrow);
|
||||
context.fibers[fiber_idx].statement.replace(None);
|
||||
// Rollback the transaction if we're in one
|
||||
if matches!(context.fibers[fiber_idx].state, FiberState::InTx) {
|
||||
if let Ok(rollback_stmt) =
|
||||
if matches!(context.fibers[fiber_idx].state, FiberState::InTx)
|
||||
&& let Ok(rollback_stmt) =
|
||||
context.fibers[fiber_idx].connection.prepare("ROLLBACK")
|
||||
{
|
||||
context.fibers[fiber_idx]
|
||||
.statement
|
||||
.replace(Some(rollback_stmt));
|
||||
context.fibers[fiber_idx].state = FiberState::Idle;
|
||||
}
|
||||
{
|
||||
context.fibers[fiber_idx]
|
||||
.statement
|
||||
.replace(Some(rollback_stmt));
|
||||
context.fibers[fiber_idx].state = FiberState::Idle;
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
@@ -427,15 +426,14 @@ fn perform_work(
|
||||
drop(stmt_borrow);
|
||||
context.fibers[fiber_idx].statement.replace(None);
|
||||
// Rollback the transaction if we're in one
|
||||
if matches!(context.fibers[fiber_idx].state, FiberState::InTx) {
|
||||
if let Ok(rollback_stmt) =
|
||||
if matches!(context.fibers[fiber_idx].state, FiberState::InTx)
|
||||
&& let Ok(rollback_stmt) =
|
||||
context.fibers[fiber_idx].connection.prepare("ROLLBACK")
|
||||
{
|
||||
context.fibers[fiber_idx]
|
||||
.statement
|
||||
.replace(Some(rollback_stmt));
|
||||
context.fibers[fiber_idx].state = FiberState::Idle;
|
||||
}
|
||||
{
|
||||
context.fibers[fiber_idx]
|
||||
.statement
|
||||
.replace(Some(rollback_stmt));
|
||||
context.fibers[fiber_idx].state = FiberState::Idle;
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user