@@ -90,15 +90,17 @@ fn test_prepare_err() {
9090 let conn = or_fail ! ( PostgresConnection :: connect( "postgres://postgres@localhost" , & NoSsl ) ) ;
9191 match conn. prepare ( "invalid sql statment" ) {
9292 Err ( PgDbError ( PostgresDbError { code : SyntaxError , position : Some ( Position ( 1 ) ) , .. } ) ) => ( ) ,
93- resp => fail ! ( "Unexpected result {:?}" , resp)
93+ Err ( e) => fail ! ( "Unexpected result {}" , e) ,
94+ _ => fail ! ( "Unexpected result" ) ,
9495 }
9596}
9697
9798#[ test]
9899fn test_unknown_database ( ) {
99100 match PostgresConnection :: connect ( "postgres://postgres@localhost/asdf" , & NoSsl ) {
100101 Err ( PgConnectDbError ( PostgresDbError { code : InvalidCatalogName , .. } ) ) => { }
101- resp => fail ! ( "Unexpected result {:?}" , resp)
102+ Err ( resp) => fail ! ( "Unexpected result {}" , resp) ,
103+ _ => fail ! ( "Unexpected result" ) ,
102104 }
103105}
104106
@@ -402,8 +404,8 @@ fn test_result_descriptions() {
402404 let conn = or_fail ! ( PostgresConnection :: connect( "postgres://postgres@localhost" , & NoSsl ) ) ;
403405 let stmt = or_fail ! ( conn. prepare( "SELECT 1::INT as a, 'hi'::VARCHAR as b" ) ) ;
404406 assert ! ( stmt. result_descriptions( ) ==
405- [ ResultDescription { name: "a" . to_owned ( ) , ty: PgInt4 } ,
406- ResultDescription { name: "b" . to_owned ( ) , ty: PgVarchar } ] ) ;
407+ [ ResultDescription { name: "a" . to_string ( ) , ty: PgInt4 } ,
408+ ResultDescription { name: "b" . to_string ( ) , ty: PgVarchar } ] ) ;
407409}
408410
409411#[ test]
@@ -445,8 +447,8 @@ fn test_i8_params() {
445447
446448#[ test]
447449fn test_name_params ( ) {
448- test_type ( "NAME" , [ ( Some ( "hello world" . to_owned ( ) ) , "'hello world'" ) ,
449- ( Some ( "イロハニホヘト チリヌルヲ" . to_owned ( ) ) , "'イロハニホヘト チリヌルヲ'" ) ,
450+ test_type ( "NAME" , [ ( Some ( "hello world" . to_string ( ) ) , "'hello world'" ) ,
451+ ( Some ( "イロハニホヘト チリヌルヲ" . to_string ( ) ) , "'イロハニホヘト チリヌルヲ'" ) ,
450452 ( None , "NULL" ) ] ) ;
451453}
452454
@@ -486,15 +488,15 @@ fn test_f64_params() {
486488
487489#[ test]
488490fn test_varchar_params ( ) {
489- test_type ( "VARCHAR" , [ ( Some ( "hello world" . to_owned ( ) ) , "'hello world'" ) ,
490- ( Some ( "イロハニホヘト チリヌルヲ" . to_owned ( ) ) , "'イロハニホヘト チリヌルヲ'" ) ,
491+ test_type ( "VARCHAR" , [ ( Some ( "hello world" . to_string ( ) ) , "'hello world'" ) ,
492+ ( Some ( "イロハニホヘト チリヌルヲ" . to_string ( ) ) , "'イロハニホヘト チリヌルヲ'" ) ,
491493 ( None , "NULL" ) ] ) ;
492494}
493495
494496#[ test]
495497fn test_text_params ( ) {
496- test_type ( "TEXT" , [ ( Some ( "hello world" . to_owned ( ) ) , "'hello world'" ) ,
497- ( Some ( "イロハニホヘト チリヌルヲ" . to_owned ( ) ) , "'イロハニホヘト チリヌルヲ'" ) ,
498+ test_type ( "TEXT" , [ ( Some ( "hello world" . to_string ( ) ) , "'hello world'" ) ,
499+ ( Some ( "イロハニホヘト チリヌルヲ" . to_string ( ) ) , "'イロハニホヘト チリヌルヲ'" ) ,
498500 ( None , "NULL" ) ] ) ;
499501}
500502
@@ -511,7 +513,7 @@ fn test_bpchar_params() {
511513 let stmt = or_fail ! ( conn. prepare( "SELECT b FROM foo ORDER BY id" ) ) ;
512514 let res = or_fail ! ( stmt. query( [ ] ) ) ;
513515
514- assert_eq ! ( vec!( Some ( "12345" . to_owned ( ) ) , Some ( "123 " . to_owned ( ) ) , None ) ,
516+ assert_eq ! ( vec!( Some ( "12345" . to_string ( ) ) , Some ( "123 " . to_string ( ) ) , None ) ,
515517 res. map( |row| row[ 1 ] ) . collect( ) ) ;
516518}
517519
@@ -556,7 +558,7 @@ fn test_tm_params() {
556558
557559macro_rules! test_range(
558560 ( $name: expr, $t: ty, $low: expr, $low_str: expr, $high: expr, $high_str: expr) => ( {
559- let tests = [ ( Some ( range!( '(' , ')' ) ) , "'(,)'" . to_owned ( ) ) ,
561+ let tests = [ ( Some ( range!( '(' , ')' ) ) , "'(,)'" . to_string ( ) ) ,
560562 ( Some ( range!( '[' $low, ')' ) ) , format!( "'[{},)'" , $low_str) ) ,
561563 ( Some ( range!( '(' $low, ')' ) ) , format!( "'({},)'" , $low_str) ) ,
562564 ( Some ( range!( '(' , $high ']' ) ) , format!( "'(,{}]'" , $high_str) ) ,
@@ -569,8 +571,8 @@ macro_rules! test_range(
569571 format!( "'({},{}]'" , $low_str, $high_str) ) ,
570572 ( Some ( range!( '(' $low, $high ')' ) ) ,
571573 format!( "'({},{})'" , $low_str, $high_str) ) ,
572- ( Some ( range!( empty) ) , "'empty'" . to_owned ( ) ) ,
573- ( None , "NULL" . to_owned ( ) ) ] ;
574+ ( Some ( range!( empty) ) , "'empty'" . to_string ( ) ) ,
575+ ( None , "NULL" . to_string ( ) ) ] ;
574576 test_type( $name, tests) ;
575577 } )
576578)
@@ -607,14 +609,14 @@ fn test_tstzrange_params() {
607609macro_rules! test_array_params(
608610 ( $name: expr, $v1: expr, $s1: expr, $v2: expr, $s2: expr, $v3: expr, $s3: expr) => ( {
609611 let tests = [ ( Some ( ArrayBase :: from_vec( vec!( Some ( $v1) , Some ( $v2) , None ) , 1 ) ) ,
610- format!( r"'\{{},{},NULL\}'" , $s1, $s2) . into_owned ( ) ) ,
611- ( None , "NULL" . to_owned ( ) ) ] ;
612+ format!( r"'\{{},{},NULL\}'" , $s1, $s2) . into_string ( ) ) ,
613+ ( None , "NULL" . to_string ( ) ) ] ;
612614 test_type( format!( "{}[]" , $name) . as_slice( ) , tests) ;
613615 let mut a = ArrayBase :: from_vec( vec!( Some ( $v1) , Some ( $v2) ) , 0 ) ;
614616 a. wrap( -1 ) ;
615617 a. push_move( ArrayBase :: from_vec( vec!( None , Some ( $v3) ) , 0 ) ) ;
616618 let tests = [ ( Some ( a) , format!( r"'[-1:0][0:1]=\{\{{},{}\},\{NULL,{}\}\}'" ,
617- $s1, $s2, $s3) . into_owned ( ) ) ] ;
619+ $s1, $s2, $s3) . into_string ( ) ) ] ;
618620 test_type( format!( "{}[][]" , $name) . as_slice( ) , tests) ;
619621 } )
620622)
@@ -638,8 +640,8 @@ fn test_chararray_params() {
638640
639641#[ test]
640642fn test_namearray_params ( ) {
641- test_array_params ! ( "NAME" , "hello" . to_owned ( ) , "hello" , "world" . to_owned ( ) ,
642- "world" , "!" . to_owned ( ) , "!" ) ;
643+ test_array_params ! ( "NAME" , "hello" . to_string ( ) , "hello" , "world" . to_string ( ) ,
644+ "world" , "!" . to_string ( ) , "!" ) ;
643645}
644646
645647#[ test]
@@ -654,20 +656,20 @@ fn test_int4array_params() {
654656
655657#[ test]
656658fn test_textarray_params ( ) {
657- test_array_params ! ( "TEXT" , "hello" . to_owned ( ) , "hello" , "world" . to_owned ( ) ,
658- "world" , "!" . to_owned ( ) , "!" ) ;
659+ test_array_params ! ( "TEXT" , "hello" . to_string ( ) , "hello" , "world" . to_string ( ) ,
660+ "world" , "!" . to_string ( ) , "!" ) ;
659661}
660662
661663#[ test]
662664fn test_charnarray_params ( ) {
663- test_array_params ! ( "CHAR(5)" , "hello" . to_owned ( ) , "hello" ,
664- "world" . to_owned ( ) , "world" , "! " . to_owned ( ) , "!" ) ;
665+ test_array_params ! ( "CHAR(5)" , "hello" . to_string ( ) , "hello" ,
666+ "world" . to_string ( ) , "world" , "! " . to_string ( ) , "!" ) ;
665667}
666668
667669#[ test]
668670fn test_varchararray_params ( ) {
669- test_array_params ! ( "VARCHAR" , "hello" . to_owned ( ) , "hello" ,
670- "world" . to_owned ( ) , "world" , "!" . to_owned ( ) , "!" ) ;
671+ test_array_params ! ( "VARCHAR" , "hello" . to_string ( ) , "hello" ,
672+ "world" . to_string ( ) , "world" , "!" . to_string ( ) , "!" ) ;
671673}
672674
673675#[ test]
@@ -751,10 +753,10 @@ fn test_hstore_params() {
751753 } )
752754 )
753755 test_type ( "hstore" ,
754- [ ( Some ( make_map ! ( "a" . to_owned ( ) => Some ( "1" . to_owned ( ) ) ) ) , "'a=>1'" ) ,
755- ( Some ( make_map ! ( "hello" . to_owned ( ) => Some ( "world!" . to_owned ( ) ) ,
756- "hola" . to_owned ( ) => Some ( "mundo!" . to_owned ( ) ) ,
757- "what" . to_owned ( ) => None ) ) ,
756+ [ ( Some ( make_map ! ( "a" . to_string ( ) => Some ( "1" . to_string ( ) ) ) ) , "'a=>1'" ) ,
757+ ( Some ( make_map ! ( "hello" . to_string ( ) => Some ( "world!" . to_string ( ) ) ,
758+ "hola" . to_string ( ) => Some ( "mundo!" . to_string ( ) ) ,
759+ "what" . to_string ( ) => None ) ) ,
758760 "'hello=>world!,hola=>mundo!,what=>NULL'" ) ,
759761 ( None , "NULL" ) ] ) ;
760762}
@@ -894,7 +896,7 @@ fn test_notification_iterator_some() {
894896 assert_eq ! ( & expected. channel, & channel) ;
895897 assert_eq ! ( & expected. payload, & payload) ;
896898 }
897- x => fail ! ( "Expected {:? } but got {:? }" , expected, x)
899+ x => fail ! ( "Expected {} but got {}" , expected, x)
898900 }
899901 }
900902
@@ -907,21 +909,21 @@ fn test_notification_iterator_some() {
907909
908910 check_notification ( PostgresNotification {
909911 pid : 0 ,
910- channel : "test_notification_iterator_one_channel" . to_owned ( ) ,
911- payload : "hello" . to_owned ( )
912+ channel : "test_notification_iterator_one_channel" . to_string ( ) ,
913+ payload : "hello" . to_string ( )
912914 } , it. next ( ) ) ;
913915 check_notification ( PostgresNotification {
914916 pid : 0 ,
915- channel : "test_notification_iterator_one_channel2" . to_owned ( ) ,
916- payload : "world" . to_owned ( )
917+ channel : "test_notification_iterator_one_channel2" . to_string ( ) ,
918+ payload : "world" . to_string ( )
917919 } , it. next ( ) ) ;
918920 assert ! ( it. next( ) . is_none( ) ) ;
919921
920922 or_fail ! ( conn. execute( "NOTIFY test_notification_iterator_one_channel, '!'" , [ ] ) ) ;
921923 check_notification ( PostgresNotification {
922924 pid : 0 ,
923- channel : "test_notification_iterator_one_channel" . to_owned ( ) ,
924- payload : "!" . to_owned ( )
925+ channel : "test_notification_iterator_one_channel" . to_string ( ) ,
926+ payload : "!" . to_string ( )
925927 } , it. next ( ) ) ;
926928 assert ! ( it. next( ) . is_none( ) ) ;
927929}
@@ -940,7 +942,8 @@ fn test_cancel_query() {
940942
941943 match conn. execute ( "SELECT pg_sleep(10)" , [ ] ) {
942944 Err ( PgDbError ( PostgresDbError { code : QueryCanceled , .. } ) ) => { }
943- res => fail ! ( "Unexpected result {:?}" , res)
945+ Err ( res) => fail ! ( "Unexpected result {}" , res) ,
946+ _ => fail ! ( "Unexpected result" ) ,
944947 }
945948}
946949
0 commit comments