Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Jan 2, 2025
1 parent 45f9a53 commit cde234c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
8 changes: 6 additions & 2 deletions rust/frontend/examples/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use edb_frontend::config::*;
use edb_frontend::listener::*;
use edb_frontend::service::*;
use edb_frontend::stream::*;
use hyper::Response;
use gel_auth::AuthType;
use gel_auth::CredentialData;
use hyper::Response;
use tokio::io::AsyncReadExt;
use tokio::io::ReadBuf;

Expand All @@ -21,7 +21,11 @@ impl BabelfishService for ExampleService {
) -> impl Future<Output = Result<CredentialData, std::io::Error>> {
eprintln!("lookup_auth: {:?}", identity);
async move {
Ok(CredentialData::new(AuthType::Trust, "matt".to_owned(), "password".to_owned()))
Ok(CredentialData::new(
AuthType::Trust,
"matt".to_owned(),
"password".to_owned(),
))
}
}

Expand Down
19 changes: 12 additions & 7 deletions rust/frontend/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,8 @@ async fn handle_stream_edgedb_binary(
bound_config: impl IsBoundConfig,
) -> Result<(), std::io::Error> {
use pgrust::{
errors::edgedb::{EdbError},
handshake::{
edgedb_server::{ConnectionDrive, ConnectionEvent, ServerState},
},
errors::edgedb::EdbError,
handshake::edgedb_server::{ConnectionDrive, ConnectionEvent, ServerState},
};

let mut resolved_identity = None;
Expand Down Expand Up @@ -400,7 +398,15 @@ async fn handle_stream_edgedb_binary(
let built = match identity.clone().build() {
Ok(built) => built,
Err(e) => {
server_state.drive(ConnectionDrive::Fail(EdbError::AuthenticationError, "Missing database or user"), &mut update).unwrap();
server_state
.drive(
ConnectionDrive::Fail(
EdbError::AuthenticationError,
"Missing database or user",
),
&mut update,
)
.unwrap();
return Ok(());
}
};
Expand Down Expand Up @@ -448,7 +454,6 @@ async fn handle_stream_edgedb_binary(
.await;

Ok(())

}

async fn handle_stream_http1x(
Expand Down Expand Up @@ -938,10 +943,10 @@ fn bind_task<C: ListenerConfig>(

#[cfg(test)]
mod tests {
use gel_auth::CredentialData;
use hyper::Uri;
use hyper_util::rt::TokioIo;
use openssl::ssl::{Ssl, SslContext, SslMethod};
use gel_auth::CredentialData;
use rstest::rstest;

use crate::{
Expand Down
8 changes: 4 additions & 4 deletions rust/pgrust/src/handshake/client_state_machine.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use super::ConnectionSslRequirement;
use gel_auth::{
scram::{generate_salted_password, ClientEnvironment, ClientTransaction, Sha256Out},
AuthType,
};
use crate::{
connection::{invalid_state, ConnectionError, Credentials, SslError},
errors::PgServerError,
Expand All @@ -19,6 +15,10 @@ use crate::{
},
};
use base64::Engine;
use gel_auth::{
scram::{generate_salted_password, ClientEnvironment, ClientTransaction, Sha256Out},
AuthType,
};
use rand::Rng;
use tracing::{error, trace, warn};

Expand Down
11 changes: 4 additions & 7 deletions rust/pgrust/src/handshake/edgedb_server.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use crate::{
connection::ConnectionError,
errors::edgedb::EdbError,
};
use crate::{connection::ConnectionError, errors::edgedb::EdbError};

use crate::protocol::{
edgedb::{data::*, *},
match_message, ParseError, StructBuffer,
};
edgedb::{data::*, *},
match_message, ParseError, StructBuffer,
};
use gel_auth::{
handshake::{ServerAuth, ServerAuthDrive, ServerAuthError, ServerAuthResponse},
AuthType, CredentialData,
Expand Down

0 comments on commit cde234c

Please sign in to comment.