diff --git a/rust/frontend/examples/listener.rs b/rust/frontend/examples/listener.rs index 5a3dfc52c3b1..cd091efa546f 100644 --- a/rust/frontend/examples/listener.rs +++ b/rust/frontend/examples/listener.rs @@ -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; @@ -21,7 +21,11 @@ impl BabelfishService for ExampleService { ) -> impl Future> { 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(), + )) } } diff --git a/rust/frontend/src/listener.rs b/rust/frontend/src/listener.rs index 8b90a0bce5a5..8fbc2d82e098 100644 --- a/rust/frontend/src/listener.rs +++ b/rust/frontend/src/listener.rs @@ -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; @@ -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(()); } }; @@ -448,7 +454,6 @@ async fn handle_stream_edgedb_binary( .await; Ok(()) - } async fn handle_stream_http1x( @@ -938,10 +943,10 @@ fn bind_task( #[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::{ diff --git a/rust/pgrust/src/handshake/client_state_machine.rs b/rust/pgrust/src/handshake/client_state_machine.rs index f2a5a6c2f1b5..7723f22b3d90 100644 --- a/rust/pgrust/src/handshake/client_state_machine.rs +++ b/rust/pgrust/src/handshake/client_state_machine.rs @@ -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, @@ -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}; diff --git a/rust/pgrust/src/handshake/edgedb_server.rs b/rust/pgrust/src/handshake/edgedb_server.rs index 61675896e6a6..e38139a4c08d 100644 --- a/rust/pgrust/src/handshake/edgedb_server.rs +++ b/rust/pgrust/src/handshake/edgedb_server.rs @@ -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,