forked from lavina/lavina
1
0
Fork 0

cargo fmt

This commit is contained in:
homycdev 2024-05-05 15:57:32 +03:00
parent 66a3bb7a68
commit ad00fe759a
5 changed files with 7 additions and 7 deletions

View File

@ -59,8 +59,10 @@ impl Storage {
#[tracing::instrument(skip(self), name = "Storage::check_user_existance")] #[tracing::instrument(skip(self), name = "Storage::check_user_existance")]
pub async fn check_user_existance(&self, username: &str) -> Result<bool> { pub async fn check_user_existance(&self, username: &str) -> Result<bool> {
let mut executor = self.conn.lock().await; let mut executor = self.conn.lock().await;
let result: Option<(String,)> = let result: Option<(String,)> = sqlx::query_as("select name from users where name = ?;")
sqlx::query_as("select name from users where name = ?;").bind(username).fetch_optional(&mut *executor).await?; .bind(username)
.fetch_optional(&mut *executor)
.await?;
Ok(result.is_some()) Ok(result.is_some())
} }

View File

@ -382,7 +382,7 @@ async fn scenario_two_users() -> Result<()> {
s1.expect(":tester1 PART #test").await?; s1.expect(":tester1 PART #test").await?;
// The second user should receive the PART message // The second user should receive the PART message
s2.expect(":tester1 PART #test").await?; s2.expect(":tester1 PART #test").await?;
s1.send("WHOIS tester2").await?; s1.send("WHOIS tester2").await?;
s1.expect(":testserver 318 tester1 tester2 :End of /WHOIS list").await?; s1.expect(":testserver 318 tester1 tester2 :End of /WHOIS list").await?;
@ -391,7 +391,6 @@ async fn scenario_two_users() -> Result<()> {
s2.expect(":testserver 401 tester2 tester3 :No such nick/channel").await?; s2.expect(":testserver 401 tester2 tester3 :No such nick/channel").await?;
s2.expect(":testserver 318 tester2 tester3 :End of /WHOIS list").await?; s2.expect(":testserver 318 tester2 tester3 :End of /WHOIS list").await?;
stream2.shutdown().await?; stream2.shutdown().await?;
server.shutdown().await?; server.shutdown().await?;

View File

@ -2,7 +2,6 @@ use tokio::io::{AsyncWrite, AsyncWriteExt};
use crate::{prelude::Str, response::WriteResponse}; use crate::{prelude::Str, response::WriteResponse};
/// ErrNoSuchNick401 /// ErrNoSuchNick401
pub struct ErrNoSuchNick401 { pub struct ErrNoSuchNick401 {
client: Str, client: Str,

View File

@ -1,2 +1,2 @@
pub mod error; pub mod error;
pub mod response; pub mod response;

View File

@ -1,12 +1,12 @@
//! Client-to-Server IRC protocol. //! Client-to-Server IRC protocol.
pub mod client; pub mod client;
pub mod commands;
mod prelude; mod prelude;
pub mod response; pub mod response;
pub mod server; pub mod server;
#[cfg(test)] #[cfg(test)]
mod testkit; mod testkit;
pub mod user; pub mod user;
pub mod commands;
use crate::prelude::Str; use crate::prelude::Str;