@@ -131,7 +131,7 @@ pub async fn client_entrypoint(
131
131
// Client requested a TLS connection.
132
132
Ok ( ( ClientConnectionType :: Tls , _) ) => {
133
133
// TLS settings are configured, will setup TLS now.
134
- if tls_certificate != None {
134
+ if tls_certificate. is_some ( ) {
135
135
debug ! ( "Accepting TLS request" ) ;
136
136
137
137
let mut yes = BytesMut :: new ( ) ;
@@ -448,7 +448,7 @@ where
448
448
None => "pgcat" ,
449
449
} ;
450
450
451
- let client_identifier = ClientIdentifier :: new ( & application_name, & username, & pool_name) ;
451
+ let client_identifier = ClientIdentifier :: new ( application_name, username, pool_name) ;
452
452
453
453
let admin = [ "pgcat" , "pgbouncer" ]
454
454
. iter ( )
@@ -795,7 +795,7 @@ where
795
795
let mut will_prepare = false ;
796
796
797
797
let client_identifier = ClientIdentifier :: new (
798
- & self . server_parameters . get_application_name ( ) ,
798
+ self . server_parameters . get_application_name ( ) ,
799
799
& self . username ,
800
800
& self . pool_name ,
801
801
) ;
@@ -982,15 +982,11 @@ where
982
982
}
983
983
984
984
// Check on plugin results.
985
- match plugin_output {
986
- Some ( PluginOutput :: Deny ( error) ) => {
987
- self . buffer . clear ( ) ;
988
- error_response ( & mut self . write , & error) . await ?;
989
- plugin_output = None ;
990
- continue ;
991
- }
992
-
993
- _ => ( ) ,
985
+ if let Some ( PluginOutput :: Deny ( error) ) = plugin_output {
986
+ self . buffer . clear ( ) ;
987
+ error_response ( & mut self . write , & error) . await ?;
988
+ plugin_output = None ;
989
+ continue ;
994
990
} ;
995
991
996
992
// Check if the pool is paused and wait until it's resumed.
@@ -1267,7 +1263,7 @@ where
1267
1263
1268
1264
// Safe to unwrap because we know this message has a certain length and has the code
1269
1265
// This reads the first byte without advancing the internal pointer and mutating the bytes
1270
- let code = * message. get ( 0 ) . unwrap ( ) as char ;
1266
+ let code = * message. first ( ) . unwrap ( ) as char ;
1271
1267
1272
1268
trace ! ( "Message: {}" , code) ;
1273
1269
@@ -1325,7 +1321,7 @@ where
1325
1321
self . stats . transaction ( ) ;
1326
1322
server
1327
1323
. stats ( )
1328
- . transaction ( & self . server_parameters . get_application_name ( ) ) ;
1324
+ . transaction ( self . server_parameters . get_application_name ( ) ) ;
1329
1325
1330
1326
// Release server back to the pool if we are in transaction mode.
1331
1327
// If we are in session mode, we keep the server until the client disconnects.
@@ -1400,13 +1396,10 @@ where
1400
1396
let close: Close = ( & message) . try_into ( ) ?;
1401
1397
1402
1398
if close. is_prepared_statement ( ) && !close. anonymous ( ) {
1403
- match self . prepared_statements . get ( & close. name ) {
1404
- Some ( parse) => {
1405
- server. will_close ( & parse. generated_name ) ;
1406
- }
1407
-
1399
+ if let Some ( parse) = self . prepared_statements . get ( & close. name ) {
1400
+ server. will_close ( & parse. generated_name ) ;
1401
+ } else {
1408
1402
// A prepared statement slipped through? Not impossible, since we don't support PREPARE yet.
1409
- None => ( ) ,
1410
1403
} ;
1411
1404
}
1412
1405
}
@@ -1445,7 +1438,7 @@ where
1445
1438
1446
1439
self . buffer . put ( & message[ ..] ) ;
1447
1440
1448
- let first_message_code = ( * self . buffer . get ( 0 ) . unwrap_or ( & 0 ) ) as char ;
1441
+ let first_message_code = ( * self . buffer . first ( ) . unwrap_or ( & 0 ) ) as char ;
1449
1442
1450
1443
// Almost certainly true
1451
1444
if first_message_code == 'P' && !prepared_statements_enabled {
@@ -1477,7 +1470,7 @@ where
1477
1470
self . stats . transaction ( ) ;
1478
1471
server
1479
1472
. stats ( )
1480
- . transaction ( & self . server_parameters . get_application_name ( ) ) ;
1473
+ . transaction ( self . server_parameters . get_application_name ( ) ) ;
1481
1474
1482
1475
// Release server back to the pool if we are in transaction mode.
1483
1476
// If we are in session mode, we keep the server until the client disconnects.
@@ -1739,7 +1732,7 @@ where
1739
1732
client_stats. query ( ) ;
1740
1733
server. stats ( ) . query (
1741
1734
Instant :: now ( ) . duration_since ( query_start) . as_millis ( ) as u64 ,
1742
- & self . server_parameters . get_application_name ( ) ,
1735
+ self . server_parameters . get_application_name ( ) ,
1743
1736
) ;
1744
1737
1745
1738
Ok ( ( ) )
0 commit comments