@@ -88,65 +88,62 @@ impl Message {
88
88
let channel = buf. read_cstr ( ) ?;
89
89
let message = buf. read_cstr ( ) ?;
90
90
Message :: NotificationResponse ( NotificationResponseBody {
91
- process_id : process_id ,
92
- channel : channel ,
93
- message : message ,
91
+ process_id,
92
+ channel,
93
+ message,
94
94
} )
95
95
}
96
96
b'c' => Message :: CopyDone ,
97
97
b'C' => {
98
98
let tag = buf. read_cstr ( ) ?;
99
- Message :: CommandComplete ( CommandCompleteBody { tag : tag } )
99
+ Message :: CommandComplete ( CommandCompleteBody { tag } )
100
100
}
101
101
b'd' => {
102
102
let storage = buf. read_all ( ) ;
103
- Message :: CopyData ( CopyDataBody { storage : storage } )
103
+ Message :: CopyData ( CopyDataBody { storage } )
104
104
}
105
105
b'D' => {
106
106
let len = buf. read_u16 :: < BigEndian > ( ) ?;
107
107
let storage = buf. read_all ( ) ;
108
- Message :: DataRow ( DataRowBody {
109
- storage : storage,
110
- len : len,
111
- } )
108
+ Message :: DataRow ( DataRowBody { storage, len } )
112
109
}
113
110
b'E' => {
114
111
let storage = buf. read_all ( ) ;
115
- Message :: ErrorResponse ( ErrorResponseBody { storage : storage } )
112
+ Message :: ErrorResponse ( ErrorResponseBody { storage } )
116
113
}
117
114
b'G' => {
118
115
let format = buf. read_u8 ( ) ?;
119
116
let len = buf. read_u16 :: < BigEndian > ( ) ?;
120
117
let storage = buf. read_all ( ) ;
121
118
Message :: CopyInResponse ( CopyInResponseBody {
122
- format : format ,
123
- len : len ,
124
- storage : storage ,
119
+ format,
120
+ len,
121
+ storage,
125
122
} )
126
123
}
127
124
b'H' => {
128
125
let format = buf. read_u8 ( ) ?;
129
126
let len = buf. read_u16 :: < BigEndian > ( ) ?;
130
127
let storage = buf. read_all ( ) ;
131
128
Message :: CopyOutResponse ( CopyOutResponseBody {
132
- format : format ,
133
- len : len ,
134
- storage : storage ,
129
+ format,
130
+ len,
131
+ storage,
135
132
} )
136
133
}
137
134
b'I' => Message :: EmptyQueryResponse ,
138
135
b'K' => {
139
136
let process_id = buf. read_i32 :: < BigEndian > ( ) ?;
140
137
let secret_key = buf. read_i32 :: < BigEndian > ( ) ?;
141
138
Message :: BackendKeyData ( BackendKeyDataBody {
142
- process_id : process_id ,
143
- secret_key : secret_key ,
139
+ process_id,
140
+ secret_key,
144
141
} )
145
142
}
146
143
b'n' => Message :: NoData ,
147
144
b'N' => {
148
145
let storage = buf. read_all ( ) ;
149
- Message :: NoticeResponse ( NoticeResponseBody { storage : storage } )
146
+ Message :: NoticeResponse ( NoticeResponseBody { storage } )
150
147
}
151
148
b'R' => match buf. read_i32 :: < BigEndian > ( ) ? {
152
149
0 => Message :: AuthenticationOk ,
@@ -155,7 +152,7 @@ impl Message {
155
152
5 => {
156
153
let mut salt = [ 0 ; 4 ] ;
157
154
buf. read_exact ( & mut salt) ?;
158
- Message :: AuthenticationMd5Password ( AuthenticationMd5PasswordBody { salt : salt } )
155
+ Message :: AuthenticationMd5Password ( AuthenticationMd5PasswordBody { salt } )
159
156
}
160
157
6 => Message :: AuthenticationScmCredential ,
161
158
7 => Message :: AuthenticationGss ,
@@ -187,30 +184,21 @@ impl Message {
187
184
b'S' => {
188
185
let name = buf. read_cstr ( ) ?;
189
186
let value = buf. read_cstr ( ) ?;
190
- Message :: ParameterStatus ( ParameterStatusBody {
191
- name : name,
192
- value : value,
193
- } )
187
+ Message :: ParameterStatus ( ParameterStatusBody { name, value } )
194
188
}
195
189
b't' => {
196
190
let len = buf. read_u16 :: < BigEndian > ( ) ?;
197
191
let storage = buf. read_all ( ) ;
198
- Message :: ParameterDescription ( ParameterDescriptionBody {
199
- storage : storage,
200
- len : len,
201
- } )
192
+ Message :: ParameterDescription ( ParameterDescriptionBody { storage, len } )
202
193
}
203
194
b'T' => {
204
195
let len = buf. read_u16 :: < BigEndian > ( ) ?;
205
196
let storage = buf. read_all ( ) ;
206
- Message :: RowDescription ( RowDescriptionBody {
207
- storage : storage,
208
- len : len,
209
- } )
197
+ Message :: RowDescription ( RowDescriptionBody { storage, len } )
210
198
}
211
199
b'Z' => {
212
200
let status = buf. read_u8 ( ) ?;
213
- Message :: ReadyForQuery ( ReadyForQueryBody { status : status } )
201
+ Message :: ReadyForQuery ( ReadyForQueryBody { status } )
214
202
}
215
203
tag => {
216
204
return Err ( io:: Error :: new (
@@ -305,7 +293,7 @@ pub struct AuthenticationSaslBody(Bytes);
305
293
306
294
impl AuthenticationSaslBody {
307
295
#[ inline]
308
- pub fn mechanisms < ' a > ( & ' a self ) -> SaslMechanisms < ' a > {
296
+ pub fn mechanisms ( & self ) -> SaslMechanisms < ' _ > {
309
297
SaslMechanisms ( & self . 0 )
310
298
}
311
299
}
@@ -410,7 +398,7 @@ impl CopyInResponseBody {
410
398
}
411
399
412
400
#[ inline]
413
- pub fn column_formats < ' a > ( & ' a self ) -> ColumnFormats < ' a > {
401
+ pub fn column_formats ( & self ) -> ColumnFormats < ' _ > {
414
402
ColumnFormats {
415
403
remaining : self . len ,
416
404
buf : & self . storage ,
@@ -464,7 +452,7 @@ impl CopyOutResponseBody {
464
452
}
465
453
466
454
#[ inline]
467
- pub fn column_formats < ' a > ( & ' a self ) -> ColumnFormats < ' a > {
455
+ pub fn column_formats ( & self ) -> ColumnFormats < ' _ > {
468
456
ColumnFormats {
469
457
remaining : self . len ,
470
458
buf : & self . storage ,
@@ -479,7 +467,7 @@ pub struct DataRowBody {
479
467
480
468
impl DataRowBody {
481
469
#[ inline]
482
- pub fn ranges < ' a > ( & ' a self ) -> DataRowRanges < ' a > {
470
+ pub fn ranges ( & self ) -> DataRowRanges < ' _ > {
483
471
DataRowRanges {
484
472
buf : & self . storage ,
485
473
len : self . storage . len ( ) ,
@@ -547,7 +535,7 @@ pub struct ErrorResponseBody {
547
535
548
536
impl ErrorResponseBody {
549
537
#[ inline]
550
- pub fn fields < ' a > ( & ' a self ) -> ErrorFields < ' a > {
538
+ pub fn fields ( & self ) -> ErrorFields < ' _ > {
551
539
ErrorFields { buf : & self . storage }
552
540
}
553
541
}
@@ -578,10 +566,7 @@ impl<'a> FallibleIterator for ErrorFields<'a> {
578
566
let value = get_str ( & self . buf [ ..value_end] ) ?;
579
567
self . buf = & self . buf [ value_end + 1 ..] ;
580
568
581
- Ok ( Some ( ErrorField {
582
- type_ : type_,
583
- value : value,
584
- } ) )
569
+ Ok ( Some ( ErrorField { type_, value } ) )
585
570
}
586
571
}
587
572
@@ -608,7 +593,7 @@ pub struct NoticeResponseBody {
608
593
609
594
impl NoticeResponseBody {
610
595
#[ inline]
611
- pub fn fields < ' a > ( & ' a self ) -> ErrorFields < ' a > {
596
+ pub fn fields ( & self ) -> ErrorFields < ' _ > {
612
597
ErrorFields { buf : & self . storage }
613
598
}
614
599
}
@@ -643,7 +628,7 @@ pub struct ParameterDescriptionBody {
643
628
644
629
impl ParameterDescriptionBody {
645
630
#[ inline]
646
- pub fn parameters < ' a > ( & ' a self ) -> Parameters < ' a > {
631
+ pub fn parameters ( & self ) -> Parameters < ' _ > {
647
632
Parameters {
648
633
buf : & self . storage ,
649
634
remaining : self . len ,
@@ -719,7 +704,7 @@ pub struct RowDescriptionBody {
719
704
720
705
impl RowDescriptionBody {
721
706
#[ inline]
722
- pub fn fields < ' a > ( & ' a self ) -> Fields < ' a > {
707
+ pub fn fields ( & self ) -> Fields < ' _ > {
723
708
Fields {
724
709
buf : & self . storage ,
725
710
remaining : self . len ,
@@ -761,13 +746,13 @@ impl<'a> FallibleIterator for Fields<'a> {
761
746
let format = self . buf . read_i16 :: < BigEndian > ( ) ?;
762
747
763
748
Ok ( Some ( Field {
764
- name : name ,
765
- table_oid : table_oid ,
766
- column_id : column_id ,
767
- type_oid : type_oid ,
768
- type_size : type_size ,
769
- type_modifier : type_modifier ,
770
- format : format ,
749
+ name,
750
+ table_oid,
751
+ column_id,
752
+ type_oid,
753
+ type_size,
754
+ type_modifier,
755
+ format,
771
756
} ) )
772
757
}
773
758
}
0 commit comments