@@ -38,12 +38,12 @@ pub enum Role {
3838 Mirror ,
3939}
4040
41- impl ToString for Role {
42- fn to_string ( & self ) -> String {
43- match * self {
44- Role :: Primary => "primary" . to_string ( ) ,
45- Role :: Replica => "replica" . to_string ( ) ,
46- Role :: Mirror => "mirror" . to_string ( ) ,
41+ impl std :: fmt :: Display for Role {
42+ fn fmt ( & self , f : & mut std :: fmt :: Formatter < ' _ > ) -> std :: fmt :: Result {
43+ match self {
44+ Role :: Primary => write ! ( f , "primary" ) ,
45+ Role :: Replica => write ! ( f , "replica" ) ,
46+ Role :: Mirror => write ! ( f , "mirror" ) ,
4747 }
4848 }
4949}
@@ -476,11 +476,11 @@ pub enum PoolMode {
476476 Session ,
477477}
478478
479- impl ToString for PoolMode {
480- fn to_string ( & self ) -> String {
481- match * self {
482- PoolMode :: Transaction => "transaction" . to_string ( ) ,
483- PoolMode :: Session => "session" . to_string ( ) ,
479+ impl std :: fmt :: Display for PoolMode {
480+ fn fmt ( & self , f : & mut std :: fmt :: Formatter < ' _ > ) -> std :: fmt :: Result {
481+ match self {
482+ PoolMode :: Transaction => write ! ( f , "transaction" ) ,
483+ PoolMode :: Session => write ! ( f , "session" ) ,
484484 }
485485 }
486486}
@@ -493,12 +493,13 @@ pub enum LoadBalancingMode {
493493 #[ serde( alias = "loc" , alias = "LOC" , alias = "least_outstanding_connections" ) ]
494494 LeastOutstandingConnections ,
495495}
496- impl ToString for LoadBalancingMode {
497- fn to_string ( & self ) -> String {
498- match * self {
499- LoadBalancingMode :: Random => "random" . to_string ( ) ,
496+
497+ impl std:: fmt:: Display for LoadBalancingMode {
498+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
499+ match self {
500+ LoadBalancingMode :: Random => write ! ( f, "random" ) ,
500501 LoadBalancingMode :: LeastOutstandingConnections => {
501- "least_outstanding_connections" . to_string ( )
502+ write ! ( f , "least_outstanding_connections" )
502503 }
503504 }
504505 }
@@ -999,15 +1000,17 @@ impl Config {
9991000 pub fn fill_up_auth_query_config ( & mut self ) {
10001001 for ( _name, pool) in self . pools . iter_mut ( ) {
10011002 if pool. auth_query . is_none ( ) {
1002- pool. auth_query = self . general . auth_query . clone ( ) ;
1003+ pool. auth_query . clone_from ( & self . general . auth_query ) ;
10031004 }
10041005
10051006 if pool. auth_query_user . is_none ( ) {
1006- pool. auth_query_user = self . general . auth_query_user . clone ( ) ;
1007+ pool. auth_query_user
1008+ . clone_from ( & self . general . auth_query_user ) ;
10071009 }
10081010
10091011 if pool. auth_query_password . is_none ( ) {
1010- pool. auth_query_password = self . general . auth_query_password . clone ( ) ;
1012+ pool. auth_query_password
1013+ . clone_from ( & self . general . auth_query_password ) ;
10111014 }
10121015 }
10131016 }
@@ -1155,7 +1158,7 @@ impl Config {
11551158 "Default max server lifetime: {}ms" ,
11561159 self . general. server_lifetime
11571160 ) ;
1158- info ! ( "Sever round robin: {}" , self . general. server_round_robin) ;
1161+ info ! ( "Server round robin: {}" , self . general. server_round_robin) ;
11591162 match self . general . tls_certificate . clone ( ) {
11601163 Some ( tls_certificate) => {
11611164 info ! ( "TLS certificate: {}" , tls_certificate) ;
0 commit comments