@@ -189,7 +189,9 @@ impl Database {
189189
190190 fn from_internal_connection ( inner : InternalConnection ) -> Self {
191191 Self {
192- inner : Arc :: new ( RwLock :: new ( Some ( DatabaseHandle :: Connection ( Arc :: new ( inner) ) ) ) ) ,
192+ inner : Arc :: new ( RwLock :: new ( Some ( DatabaseHandle :: Connection ( Arc :: new (
193+ inner,
194+ ) ) ) ) ) ,
193195 }
194196 }
195197
@@ -445,8 +447,7 @@ impl Database {
445447 use crate :: internal:: ConnectionTrait ;
446448
447449 let conn = self . __internal_connection ( ) ?;
448- conn
449- . execute_unprepared ( "SELECT 1" )
450+ conn. execute_unprepared ( "SELECT 1" )
450451 . await
451452 . map ( |_| true )
452453 . map_err ( |e| Error :: connection ( e. to_string ( ) ) )
@@ -509,10 +510,12 @@ impl Database {
509510 let stmt = Statement :: from_string ( backend, sql. to_string ( ) ) ;
510511
511512 let results = match db. __get_connection ( ) ? {
512- ConnectionRef :: Database ( conn) => crate :: profiling:: __profile_future ( conn. query_all_raw ( stmt) )
513- . await ,
514- ConnectionRef :: Transaction ( tx) => crate :: profiling:: __profile_future ( tx. as_ref ( ) . query_all_raw ( stmt) )
515- . await ,
513+ ConnectionRef :: Database ( conn) => {
514+ crate :: profiling:: __profile_future ( conn. query_all_raw ( stmt) ) . await
515+ }
516+ ConnectionRef :: Transaction ( tx) => {
517+ crate :: profiling:: __profile_future ( tx. as_ref ( ) . query_all_raw ( stmt) ) . await
518+ }
516519 }
517520 . map_err ( |e| Error :: query ( e. to_string ( ) ) ) ?;
518521
@@ -564,7 +567,8 @@ impl Database {
564567 crate :: profiling:: __profile_future ( conn. query_all_raw ( stmt) ) . await
565568 }
566569 ConnectionRef :: Transaction ( tx) => {
567- let stmt = Statement :: from_sql_and_values ( tx. as_ref ( ) . get_database_backend ( ) , sql, params) ;
570+ let stmt =
571+ Statement :: from_sql_and_values ( tx. as_ref ( ) . get_database_backend ( ) , sql, params) ;
568572 crate :: profiling:: __profile_future ( tx. as_ref ( ) . query_all_raw ( stmt) ) . await
569573 }
570574 }
@@ -640,7 +644,8 @@ impl Database {
640644 crate :: profiling:: __profile_future ( conn. execute_raw ( stmt) ) . await
641645 }
642646 ConnectionRef :: Transaction ( tx) => {
643- let stmt = Statement :: from_sql_and_values ( tx. as_ref ( ) . get_database_backend ( ) , sql, params) ;
647+ let stmt =
648+ Statement :: from_sql_and_values ( tx. as_ref ( ) . get_database_backend ( ) , sql, params) ;
644649 crate :: profiling:: __profile_future ( tx. as_ref ( ) . execute_raw ( stmt) ) . await
645650 }
646651 }
@@ -679,10 +684,12 @@ impl Database {
679684 let stmt = Statement :: from_string ( backend, sql. to_string ( ) ) ;
680685
681686 let results = match db. __get_connection ( ) ? {
682- ConnectionRef :: Database ( conn) => crate :: profiling:: __profile_future ( conn. query_all_raw ( stmt) )
683- . await ,
684- ConnectionRef :: Transaction ( tx) => crate :: profiling:: __profile_future ( tx. as_ref ( ) . query_all_raw ( stmt) )
685- . await ,
687+ ConnectionRef :: Database ( conn) => {
688+ crate :: profiling:: __profile_future ( conn. query_all_raw ( stmt) ) . await
689+ }
690+ ConnectionRef :: Transaction ( tx) => {
691+ crate :: profiling:: __profile_future ( tx. as_ref ( ) . query_all_raw ( stmt) ) . await
692+ }
686693 }
687694 . map_err ( |e| Error :: query ( e. to_string ( ) ) ) ?;
688695
@@ -713,7 +720,8 @@ impl Database {
713720 crate :: profiling:: __profile_future ( conn. query_all_raw ( stmt) ) . await
714721 }
715722 ConnectionRef :: Transaction ( tx) => {
716- let stmt = Statement :: from_sql_and_values ( tx. as_ref ( ) . get_database_backend ( ) , sql, params) ;
723+ let stmt =
724+ Statement :: from_sql_and_values ( tx. as_ref ( ) . get_database_backend ( ) , sql, params) ;
717725 crate :: profiling:: __profile_future ( tx. as_ref ( ) . query_all_raw ( stmt) ) . await
718726 }
719727 }
@@ -978,7 +986,9 @@ impl DatabaseBuilder {
978986 . await
979987 . map_err ( |e| Error :: connection ( e. to_string ( ) ) ) ?;
980988
981- Ok ( Database :: from_internal_connection ( InternalConnection { conn } ) )
989+ Ok ( Database :: from_internal_connection ( InternalConnection {
990+ conn,
991+ } ) )
982992 }
983993}
984994
@@ -1008,7 +1018,9 @@ pub enum ConnectionRef {
10081018impl Connection for Database {
10091019 fn __get_connection ( & self ) -> Result < ConnectionRef > {
10101020 Ok ( match self . current_handle ( ) ? {
1011- DatabaseHandle :: Connection ( inner) => ConnectionRef :: Database ( inner. connection ( ) . clone ( ) ) ,
1021+ DatabaseHandle :: Connection ( inner) => {
1022+ ConnectionRef :: Database ( inner. connection ( ) . clone ( ) )
1023+ }
10121024 DatabaseHandle :: Transaction ( tx) => ConnectionRef :: Transaction ( tx) ,
10131025 } )
10141026 }
0 commit comments