@@ -38,12 +38,12 @@ pub enum Role {
38
38
Mirror ,
39
39
}
40
40
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" ) ,
47
47
}
48
48
}
49
49
}
@@ -476,11 +476,11 @@ pub enum PoolMode {
476
476
Session ,
477
477
}
478
478
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" ) ,
484
484
}
485
485
}
486
486
}
@@ -493,12 +493,13 @@ pub enum LoadBalancingMode {
493
493
#[ serde( alias = "loc" , alias = "LOC" , alias = "least_outstanding_connections" ) ]
494
494
LeastOutstandingConnections ,
495
495
}
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" ) ,
500
501
LoadBalancingMode :: LeastOutstandingConnections => {
501
- "least_outstanding_connections" . to_string ( )
502
+ write ! ( f , "least_outstanding_connections" )
502
503
}
503
504
}
504
505
}
@@ -999,15 +1000,17 @@ impl Config {
999
1000
pub fn fill_up_auth_query_config ( & mut self ) {
1000
1001
for ( _name, pool) in self . pools . iter_mut ( ) {
1001
1002
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 ) ;
1003
1004
}
1004
1005
1005
1006
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 ) ;
1007
1009
}
1008
1010
1009
1011
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 ) ;
1011
1014
}
1012
1015
}
1013
1016
}
@@ -1155,7 +1158,7 @@ impl Config {
1155
1158
"Default max server lifetime: {}ms" ,
1156
1159
self . general. server_lifetime
1157
1160
) ;
1158
- info ! ( "Sever round robin: {}" , self . general. server_round_robin) ;
1161
+ info ! ( "Server round robin: {}" , self . general. server_round_robin) ;
1159
1162
match self . general . tls_certificate . clone ( ) {
1160
1163
Some ( tls_certificate) => {
1161
1164
info ! ( "TLS certificate: {}" , tls_certificate) ;
0 commit comments