This commit is contained in:
Victor Mignot 2022-11-19 21:33:38 -05:00
parent 3c11236404
commit cf7a65674b
No known key found for this signature in database
GPG key ID: FFE4EF056FB5E0D0
3 changed files with 7 additions and 7 deletions

View file

@ -23,11 +23,11 @@ pub struct Client {
impl Client { impl Client {
/// Create a new database client /// Create a new database client
pub fn new(credentials: DatabaseCredentials) -> Client { pub fn new(credentials: DatabaseCredentials) -> Client {
return Client { Client {
credentials, credentials,
mongo_client: None, mongo_client: None,
database: None, database: None,
}; }
} }
/// Connect the client /// Connect the client
@ -76,7 +76,7 @@ impl Client {
} }
} }
if missing_collections.len() != 0 { if !missing_collections.is_empty() {
panic!( panic!(
"Missing the following the following collections: {}", "Missing the following the following collections: {}",
missing_collections.join(", ") missing_collections.join(", ")
@ -115,7 +115,7 @@ impl Client {
.expect("Could not issue request") .expect("Could not issue request")
.expect("Could not find matching data"); .expect("Could not find matching data");
return from_bson(Bson::Document(result)).expect("Could not deserialize data"); from_bson(Bson::Document(result)).expect("Could not deserialize data")
} }
#[allow(dead_code)] #[allow(dead_code)]

View file

@ -35,11 +35,11 @@ pub struct Tag {
impl YorokobotModel for Guild { impl YorokobotModel for Guild {
fn get_collection_name() -> String { fn get_collection_name() -> String {
return "guilds".to_string(); "guilds".to_string()
} }
} }
impl YorokobotModel for Tag { impl YorokobotModel for Tag {
fn get_collection_name() -> String { fn get_collection_name() -> String {
return "traits".to_string(); "traits".to_string()
} }
} }

View file

@ -34,7 +34,7 @@ async fn main() -> std::process::ExitCode {
let credentials = ClientCredentials { let credentials = ClientCredentials {
discord_token: &discord_token, discord_token: &discord_token,
db_credentials: db_credentials, db_credentials,
}; };
let mut client = match Client::new(credentials).await { let mut client = match Client::new(credentials).await {