mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-04 08:54:20 +01:00
chore: fix clippy warnings
This commit is contained in:
@@ -105,18 +105,15 @@ impl Stmt {
|
||||
match self {
|
||||
Self::AlterTable(alter_table) => {
|
||||
let (_, body) = &**alter_table;
|
||||
match body {
|
||||
AlterTableBody::AddColumn(cd) => {
|
||||
for c in cd {
|
||||
if let ColumnConstraint::PrimaryKey { .. } = c {
|
||||
return Err(custom_err!("Cannot add a PRIMARY KEY column"));
|
||||
}
|
||||
if let ColumnConstraint::Unique(..) = c {
|
||||
return Err(custom_err!("Cannot add a UNIQUE column"));
|
||||
}
|
||||
if let AlterTableBody::AddColumn(cd) = body {
|
||||
for c in cd {
|
||||
if let ColumnConstraint::PrimaryKey { .. } = c {
|
||||
return Err(custom_err!("Cannot add a PRIMARY KEY column"));
|
||||
}
|
||||
if let ColumnConstraint::Unique(..) = c {
|
||||
return Err(custom_err!("Cannot add a UNIQUE column"));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -164,10 +161,8 @@ impl Stmt {
|
||||
let Delete {
|
||||
order_by, limit, ..
|
||||
} = &**delete;
|
||||
if let Some(_) = order_by {
|
||||
if limit.is_none() {
|
||||
return Err(custom_err!("ORDER BY without LIMIT on DELETE"));
|
||||
}
|
||||
if order_by.is_some() && limit.is_none() {
|
||||
return Err(custom_err!("ORDER BY without LIMIT on DELETE"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -177,7 +172,7 @@ impl Stmt {
|
||||
return Ok(());
|
||||
}
|
||||
let columns = columns.as_ref().unwrap();
|
||||
match &*body {
|
||||
match body {
|
||||
InsertBody::Select(select, ..) => match select.body.select.column_count() {
|
||||
ColumnCount::Fixed(n) if n != columns.len() => {
|
||||
Err(custom_err!("{} values for {} columns", n, columns.len()))
|
||||
@@ -193,10 +188,8 @@ impl Stmt {
|
||||
let Update {
|
||||
order_by, limit, ..
|
||||
} = &**update;
|
||||
if let Some(_) = order_by {
|
||||
if limit.is_none() {
|
||||
return Err(custom_err!("ORDER BY without LIMIT on UPDATE"));
|
||||
}
|
||||
if order_by.is_some() && limit.is_none() {
|
||||
return Err(custom_err!("ORDER BY without LIMIT on UPDATE"));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user