mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Use nightly clippy to kill dead code/fix style (#12334)
- **Remove duplicated imports** - **Remove unused field in `CompletionOptions`** - **Remove unused struct in `nu-table`** - **Clarify generic bounds** - **Simplify a subtrait bound for `ExactSizeIterator`** - **Use `unwrap_or_default`** - **Use `Option` directly instead of empty string** - **Elide unneeded clone in `to html`**
This commit is contained in:
committed by
GitHub
parent
ff2aba7ae3
commit
e889679d42
@ -85,24 +85,22 @@ impl Command for StorDelete {
|
||||
let db = Box::new(SQLiteDatabase::new(std::path::Path::new(MEMORY_DB), None));
|
||||
|
||||
if let Some(new_table_name) = table_name_opt {
|
||||
let where_clause = match where_clause_opt {
|
||||
Some(where_stmt) => where_stmt,
|
||||
None => String::new(),
|
||||
};
|
||||
|
||||
if let Ok(conn) = db.open_connection() {
|
||||
let sql_stmt = if where_clause.is_empty() {
|
||||
// We're deleting an entire table
|
||||
format!("DROP TABLE {}", new_table_name)
|
||||
} else {
|
||||
// We're just deleting some rows
|
||||
let mut delete_stmt = format!("DELETE FROM {} ", new_table_name);
|
||||
let sql_stmt = match where_clause_opt {
|
||||
None => {
|
||||
// We're deleting an entire table
|
||||
format!("DROP TABLE {}", new_table_name)
|
||||
}
|
||||
Some(where_clause) => {
|
||||
// We're just deleting some rows
|
||||
let mut delete_stmt = format!("DELETE FROM {} ", new_table_name);
|
||||
|
||||
// Yup, this is a bit janky, but I'm not sure a better way to do this without having
|
||||
// --and and --or flags as well as supporting ==, !=, <>, is null, is not null, etc.
|
||||
// and other sql syntax. So, for now, just type a sql where clause as a string.
|
||||
delete_stmt.push_str(&format!("WHERE {}", where_clause));
|
||||
delete_stmt
|
||||
// Yup, this is a bit janky, but I'm not sure a better way to do this without having
|
||||
// --and and --or flags as well as supporting ==, !=, <>, is null, is not null, etc.
|
||||
// and other sql syntax. So, for now, just type a sql where clause as a string.
|
||||
delete_stmt.push_str(&format!("WHERE {}", where_clause));
|
||||
delete_stmt
|
||||
}
|
||||
};
|
||||
|
||||
// dbg!(&sql_stmt);
|
||||
|
Reference in New Issue
Block a user