@@ -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
}
@@ -488,11 +488,11 @@ pub enum PoolMode {
488
488
Session ,
489
489
}
490
490
491
- impl ToString for PoolMode {
492
- fn to_string ( & self ) -> String {
493
- match * self {
494
- PoolMode :: Transaction => "transaction" . to_string ( ) ,
495
- PoolMode :: Session => "session" . to_string ( ) ,
491
+ impl std :: fmt :: Display for PoolMode {
492
+ fn fmt ( & self , f : & mut std :: fmt :: Formatter < ' _ > ) -> std :: fmt :: Result {
493
+ match self {
494
+ PoolMode :: Transaction => write ! ( f , "transaction" ) ,
495
+ PoolMode :: Session => write ! ( f , "session" ) ,
496
496
}
497
497
}
498
498
}
@@ -505,12 +505,13 @@ pub enum LoadBalancingMode {
505
505
#[ serde( alias = "loc" , alias = "LOC" , alias = "least_outstanding_connections" ) ]
506
506
LeastOutstandingConnections ,
507
507
}
508
- impl ToString for LoadBalancingMode {
509
- fn to_string ( & self ) -> String {
510
- match * self {
511
- LoadBalancingMode :: Random => "random" . to_string ( ) ,
508
+
509
+ impl std:: fmt:: Display for LoadBalancingMode {
510
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
511
+ match self {
512
+ LoadBalancingMode :: Random => write ! ( f, "random" ) ,
512
513
LoadBalancingMode :: LeastOutstandingConnections => {
513
- "least_outstanding_connections" . to_string ( )
514
+ write ! ( f , "least_outstanding_connections" )
514
515
}
515
516
}
516
517
}
@@ -1011,15 +1012,17 @@ impl Config {
1011
1012
pub fn fill_up_auth_query_config ( & mut self ) {
1012
1013
for ( _name, pool) in self . pools . iter_mut ( ) {
1013
1014
if pool. auth_query . is_none ( ) {
1014
- pool. auth_query = self . general . auth_query . clone ( ) ;
1015
+ pool. auth_query . clone_from ( & self . general . auth_query ) ;
1015
1016
}
1016
1017
1017
1018
if pool. auth_query_user . is_none ( ) {
1018
- pool. auth_query_user = self . general . auth_query_user . clone ( ) ;
1019
+ pool. auth_query_user
1020
+ . clone_from ( & self . general . auth_query_user ) ;
1019
1021
}
1020
1022
1021
1023
if pool. auth_query_password . is_none ( ) {
1022
- pool. auth_query_password = self . general . auth_query_password . clone ( ) ;
1024
+ pool. auth_query_password
1025
+ . clone_from ( & self . general . auth_query_password ) ;
1023
1026
}
1024
1027
}
1025
1028
}
@@ -1167,7 +1170,7 @@ impl Config {
1167
1170
"Default max server lifetime: {}ms" ,
1168
1171
self . general. server_lifetime
1169
1172
) ;
1170
- info ! ( "Sever round robin: {}" , self . general. server_round_robin) ;
1173
+ info ! ( "Server round robin: {}" , self . general. server_round_robin) ;
1171
1174
match self . general . tls_certificate . clone ( ) {
1172
1175
Some ( tls_certificate) => {
1173
1176
info ! ( "TLS certificate: {}" , tls_certificate) ;
0 commit comments