@@ -10,7 +10,6 @@ use pin_project_lite::pin_project;
10
10
use postgres_protocol:: escape:: { escape_identifier, escape_literal} ;
11
11
use postgres_protocol:: message:: backend:: { Message , ReplicationMessage } ;
12
12
use postgres_protocol:: message:: frontend;
13
- use std:: io;
14
13
use std:: marker:: PhantomPinned ;
15
14
use std:: pin:: Pin ;
16
15
use std:: str:: from_utf8;
@@ -76,18 +75,12 @@ impl ReplicationClient {
76
75
let fields = rowdesc. fields ( ) . collect :: < Vec < _ > > ( ) . map_err ( Error :: parse) ?;
77
76
let ranges = datarow. ranges ( ) . collect :: < Vec < _ > > ( ) . map_err ( Error :: parse) ?;
78
77
79
- if fields. len ( ) != 4
80
- || fields[ 0 ] . type_oid ( ) != Type :: TEXT . oid ( )
81
- || fields[ 1 ] . type_oid ( ) != Type :: INT4 . oid ( )
82
- || fields[ 2 ] . type_oid ( ) != Type :: TEXT . oid ( )
83
- || fields[ 3 ] . type_oid ( ) != Type :: TEXT . oid ( )
84
- || ranges. len ( ) != 4
85
- {
86
- return Err ( Error :: parse ( io:: Error :: new (
87
- io:: ErrorKind :: InvalidInput ,
88
- "expected (text, int4, text, text) result" ,
89
- ) ) ) ;
90
- } ;
78
+ assert_eq ! ( fields. len( ) , 4 ) ;
79
+ assert_eq ! ( fields[ 0 ] . type_oid( ) , Type :: TEXT . oid( ) ) ;
80
+ assert_eq ! ( fields[ 1 ] . type_oid( ) , Type :: INT4 . oid( ) ) ;
81
+ assert_eq ! ( fields[ 2 ] . type_oid( ) , Type :: TEXT . oid( ) ) ;
82
+ assert_eq ! ( fields[ 3 ] . type_oid( ) , Type :: TEXT . oid( ) ) ;
83
+ assert_eq ! ( ranges. len( ) , 4 ) ;
91
84
92
85
let values: Vec < Option < & str > > = ranges
93
86
. iter ( )
@@ -133,12 +126,9 @@ impl ReplicationClient {
133
126
let fields = rowdesc. fields ( ) . collect :: < Vec < _ > > ( ) . map_err ( Error :: parse) ?;
134
127
let ranges = datarow. ranges ( ) . collect :: < Vec < _ > > ( ) . map_err ( Error :: parse) ?;
135
128
136
- if fields. len ( ) != 1 || fields[ 0 ] . type_oid ( ) != Type :: TEXT . oid ( ) || ranges. len ( ) != 1 {
137
- return Err ( Error :: parse ( io:: Error :: new (
138
- io:: ErrorKind :: InvalidInput ,
139
- "expected single text column in response" ,
140
- ) ) ) ;
141
- } ;
129
+ assert_eq ! ( fields. len( ) , 1 ) ;
130
+ assert_eq ! ( fields[ 0 ] . type_oid( ) , Type :: TEXT . oid( ) ) ;
131
+ assert_eq ! ( ranges. len( ) , 1 ) ;
142
132
143
133
let val = from_utf8 ( & datarow. buffer ( ) [ ranges[ 0 ] . to_owned ( ) . unwrap ( ) ] ) . unwrap ( ) ;
144
134
0 commit comments