From 7a56c93b8100bfcdaaa6725840d47bba41b99fb1 Mon Sep 17 00:00:00 2001 From: Diego Reis Date: Thu, 25 Sep 2025 10:39:38 -0300 Subject: [PATCH] Makes clippy happy --- bindings/python/src/lib.rs | 8 ++++---- cli/app.rs | 3 +-- parser/src/parser.rs | 2 +- whopper/main.rs | 30 ++++++++++++++---------------- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 9085a9b1b..1f99101c2 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -348,13 +348,13 @@ fn py_to_db_value(obj: &Bound) -> Result { if obj.is_none() { Ok(Value::Null) } else if let Ok(integer) = obj.extract::() { - return Ok(Value::Integer(integer)); + Ok(Value::Integer(integer)) } else if let Ok(float) = obj.extract::() { - return Ok(Value::Float(float)); + Ok(Value::Float(float)) } else if let Ok(string) = obj.extract::() { - return Ok(Value::Text(string.into())); + Ok(Value::Text(string.into())) } else if let Ok(bytes) = obj.downcast::() { - return Ok(Value::Blob(bytes.as_bytes().to_vec())); + Ok(Value::Blob(bytes.as_bytes().to_vec())) } else { return Err(PyErr::new::(format!( "Unsupported Python type: {}", diff --git a/cli/app.rs b/cli/app.rs index ff07aa08c..8fa9b0aaa 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -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); diff --git a/parser/src/parser.rs b/parser/src/parser.rs index 2fde878e4..3c91d8241 100644 --- a/parser/src/parser.rs +++ b/parser/src/parser.rs @@ -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))), diff --git a/whopper/main.rs b/whopper/main.rs index 421293284..d401b47d6 100644 --- a/whopper/main.rs +++ b/whopper/main.rs @@ -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(()); }