Fix clippy

This commit is contained in:
Chris Tsang 2023-08-04 20:26:12 +01:00
parent f2dfbab3a0
commit ef861294e2
3 changed files with 3 additions and 47 deletions

View File

@ -23,7 +23,7 @@ use select::*;
#[async_std::main] #[async_std::main]
async fn main() { async fn main() {
let db = Database::connect("sql://sea:sea@localhost/bakery") let db = Database::connect("mysql://sea:sea@localhost/test")
.await .await
.unwrap(); .unwrap();
@ -32,8 +32,4 @@ async fn main() {
println!("===== =====\n"); println!("===== =====\n");
all_about_select(&db).await.unwrap(); all_about_select(&db).await.unwrap();
println!("===== =====\n");
all_about_operation(&db).await.unwrap();
} }

View File

@ -2,46 +2,8 @@ use super::*;
use sea_orm::{entity::*, error::*, query::*, DbConn, FromQueryResult}; use sea_orm::{entity::*, error::*, query::*, DbConn, FromQueryResult};
pub async fn all_about_select(db: &DbConn) -> Result<(), DbErr> { pub async fn all_about_select(db: &DbConn) -> Result<(), DbErr> {
find_all(db).await?;
println!("===== =====\n");
find_one(db).await?;
println!("===== =====\n");
find_one_to_one(db).await?;
println!("===== =====\n");
find_one_to_many(db).await?; find_one_to_many(db).await?;
println!("===== =====\n");
count_fruits_by_cake(db).await?;
println!("===== =====\n");
find_many_to_many(db).await?;
if false {
println!("===== =====\n");
all_about_select_json(db).await?;
}
println!("===== =====\n");
find_all_stream(db).await.unwrap();
println!("===== =====\n");
find_first_page(db).await.unwrap();
println!("===== =====\n");
find_num_pages(db).await.unwrap();
Ok(()) Ok(())
} }

View File

@ -1054,11 +1054,9 @@ where
} else { } else {
acc.insert(key, vec![value]); acc.insert(key, vec![value]);
} }
} else { } else if acc.get(&key).is_none() {
if acc.get(&key).is_none() {
acc.insert(key, vec![]); acc.insert(key, vec![]);
} }
}
acc acc
}); });