1
1
extern crate fallible_iterator;
2
+ #[ cfg( feature = "native-tls" ) ]
3
+ extern crate native_tls;
4
+ #[ cfg( feature = "with-openssl" ) ]
5
+ extern crate openssl;
2
6
extern crate postgres;
3
7
#[ macro_use]
4
8
extern crate postgres_shared;
5
- extern crate url;
6
- #[ cfg( feature = "with-openssl" ) ]
7
- extern crate openssl;
8
9
#[ cfg( feature = "with-security-framework" ) ]
9
10
extern crate security_framework;
10
- #[ cfg( feature = "native-tls" ) ]
11
- extern crate native_tls;
11
+ extern crate url;
12
12
13
13
use fallible_iterator:: FallibleIterator ;
14
- use postgres:: { HandleNotice , Connection , GenericConnection , TlsMode } ;
14
+ use postgres:: { Connection , GenericConnection , HandleNotice , TlsMode } ;
15
15
use postgres:: transaction:: { self , IsolationLevel } ;
16
- use postgres:: error:: { DbError , SYNTAX_ERROR , QUERY_CANCELED , UNDEFINED_TABLE ,
17
- INVALID_CATALOG_NAME , INVALID_PASSWORD , CARDINALITY_VIOLATION } ;
18
- use postgres:: types:: { Oid , Type , Kind , WrongType , INT4 , VARCHAR , FLOAT8 } ;
16
+ use postgres:: error:: { DbError , CARDINALITY_VIOLATION , INVALID_CATALOG_NAME , INVALID_PASSWORD ,
17
+ QUERY_CANCELED , SYNTAX_ERROR , UNDEFINED_TABLE } ;
18
+ use postgres:: types:: { FLOAT8 , INT4 , Kind , Oid , Type , WrongType , VARCHAR } ;
19
19
use postgres:: error:: ErrorPosition :: Normal ;
20
20
use postgres:: notification:: Notification ;
21
21
use postgres:: params:: IntoConnectParams ;
@@ -532,10 +532,7 @@ fn test_lazy_query() {
532
532
) ) ;
533
533
534
534
let trans = or_panic ! ( conn. transaction( ) ) ;
535
- or_panic ! ( trans. execute(
536
- "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" ,
537
- & [ ] ,
538
- ) ) ;
535
+ or_panic ! ( trans. execute( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , & [ ] , ) ) ;
539
536
let stmt = or_panic ! ( trans. prepare( "INSERT INTO foo (id) VALUES ($1)" ) ) ;
540
537
let values = vec ! [ 0i32 , 1 , 2 , 3 , 4 , 5 ] ;
541
538
for value in & values {
@@ -936,14 +933,11 @@ fn test_cancel_query() {
936
933
#[ test]
937
934
#[ cfg( feature = "with-openssl" ) ]
938
935
fn test_require_ssl_conn ( ) {
939
- use openssl:: ssl:: { SslMethod , SslConnectorBuilder } ;
936
+ use openssl:: ssl:: { SslConnectorBuilder , SslMethod } ;
940
937
use postgres:: tls:: openssl:: OpenSsl ;
941
938
942
939
let mut builder = SslConnectorBuilder :: new ( SslMethod :: tls ( ) ) . unwrap ( ) ;
943
- builder
944
- . builder_mut ( )
945
- . set_ca_file ( "../test/server.crt" )
946
- . unwrap ( ) ;
940
+ builder. set_ca_file ( "../test/server.crt" ) . unwrap ( ) ;
947
941
let negotiator = OpenSsl :: from ( builder. build ( ) ) ;
948
942
let conn = or_panic ! ( Connection :: connect(
949
943
"postgres://postgres@localhost:5433" ,
@@ -955,14 +949,11 @@ fn test_require_ssl_conn() {
955
949
#[ test]
956
950
#[ cfg( feature = "with-openssl" ) ]
957
951
fn test_prefer_ssl_conn ( ) {
958
- use openssl:: ssl:: { SslMethod , SslConnectorBuilder } ;
952
+ use openssl:: ssl:: { SslConnectorBuilder , SslMethod } ;
959
953
use postgres:: tls:: openssl:: OpenSsl ;
960
954
961
955
let mut builder = SslConnectorBuilder :: new ( SslMethod :: tls ( ) ) . unwrap ( ) ;
962
- builder
963
- . builder_mut ( )
964
- . set_ca_file ( "../test/server.crt" )
965
- . unwrap ( ) ;
956
+ builder. set_ca_file ( "../test/server.crt" ) . unwrap ( ) ;
966
957
let negotiator = OpenSsl :: from ( builder. build ( ) ) ;
967
958
let conn = or_panic ! ( Connection :: connect(
968
959
"postgres://postgres@localhost:5433" ,
@@ -1400,36 +1391,28 @@ fn test_transaction_isolation_level() {
1400
1391
or_panic!( conn. transaction_isolation( ) )
1401
1392
) ;
1402
1393
or_panic ! ( conn. set_transaction_config(
1403
- transaction:: Config :: new( ) . isolation_level(
1404
- IsolationLevel :: ReadUncommitted ,
1405
- ) ,
1394
+ transaction:: Config :: new( ) . isolation_level( IsolationLevel :: ReadUncommitted , ) ,
1406
1395
) ) ;
1407
1396
assert_eq ! (
1408
1397
IsolationLevel :: ReadUncommitted ,
1409
1398
or_panic!( conn. transaction_isolation( ) )
1410
1399
) ;
1411
1400
or_panic ! ( conn. set_transaction_config(
1412
- transaction:: Config :: new( ) . isolation_level(
1413
- IsolationLevel :: RepeatableRead ,
1414
- ) ,
1401
+ transaction:: Config :: new( ) . isolation_level( IsolationLevel :: RepeatableRead , ) ,
1415
1402
) ) ;
1416
1403
assert_eq ! (
1417
1404
IsolationLevel :: RepeatableRead ,
1418
1405
or_panic!( conn. transaction_isolation( ) )
1419
1406
) ;
1420
1407
or_panic ! ( conn. set_transaction_config(
1421
- transaction:: Config :: new( ) . isolation_level(
1422
- IsolationLevel :: Serializable ,
1423
- ) ,
1408
+ transaction:: Config :: new( ) . isolation_level( IsolationLevel :: Serializable , ) ,
1424
1409
) ) ;
1425
1410
assert_eq ! (
1426
1411
IsolationLevel :: Serializable ,
1427
1412
or_panic!( conn. transaction_isolation( ) )
1428
1413
) ;
1429
1414
or_panic ! ( conn. set_transaction_config(
1430
- transaction:: Config :: new( ) . isolation_level(
1431
- IsolationLevel :: ReadCommitted ,
1432
- ) ,
1415
+ transaction:: Config :: new( ) . isolation_level( IsolationLevel :: ReadCommitted , ) ,
1433
1416
) ) ;
1434
1417
assert_eq ! (
1435
1418
IsolationLevel :: ReadCommitted ,
0 commit comments