File tree Expand file tree Collapse file tree 5 files changed +16
-23
lines changed Expand file tree Collapse file tree 5 files changed +16
-23
lines changed Original file line number Diff line number Diff line change @@ -137,17 +137,17 @@ fn extract_group_type_from_groupping_set(
137137 match expr {
138138 Expr :: GroupingSet ( groupping_set) => match groupping_set {
139139 GroupingSet :: Rollup ( exprs) => {
140- result. extend (
141- iter :: repeat ( Some ( GroupingSetDesc :: new ( GroupingSetType :: Rollup , id) ) )
142- . take ( exprs. len ( ) ) ,
143- ) ;
140+ result. extend ( std :: iter :: repeat_n (
141+ Some ( GroupingSetDesc :: new ( GroupingSetType :: Rollup , id) ) ,
142+ exprs. len ( ) ,
143+ ) ) ;
144144 id += 1 ;
145145 }
146146 GroupingSet :: Cube ( exprs) => {
147- result. extend (
148- iter :: repeat ( Some ( GroupingSetDesc :: new ( GroupingSetType :: Cube , id) ) )
149- . take ( exprs. len ( ) ) ,
150- ) ;
147+ result. extend ( std :: iter :: repeat_n (
148+ Some ( GroupingSetDesc :: new ( GroupingSetType :: Cube , id) ) ,
149+ exprs. len ( ) ,
150+ ) ) ;
151151 id += 1 ;
152152 }
153153 GroupingSet :: GroupingSets ( _) => {
Original file line number Diff line number Diff line change @@ -2708,7 +2708,7 @@ impl MemberRules {
27082708 let Some ( left_cube) = left_join_hints
27092709 . iter ( )
27102710 . filter ( |hint| !hint. is_empty ( ) )
2711- . last ( )
2711+ . next_back ( )
27122712 . and_then ( |hint| hint. last ( ) )
27132713 . or_else ( || left_alias_to_cube. first ( ) . map ( |( _, cube) | cube) )
27142714 . cloned ( )
Original file line number Diff line number Diff line change @@ -94,10 +94,7 @@ pub async fn read_contents<Reader: AsyncReadExt + Unpin>(
9494 // protocol defines length for all types of messages
9595 let length = reader. read_u32 ( ) . await ?;
9696 if length < 4 {
97- return Err ( Error :: new (
98- ErrorKind :: Other ,
99- "Unexpectedly small (<0) message size" ,
100- ) ) ;
97+ return Err ( Error :: other ( "Unexpectedly small (<0) message size" ) ) ;
10198 }
10299
103100 trace ! (
Original file line number Diff line number Diff line change @@ -21,13 +21,10 @@ impl ToProtocolValue for DateValue {
2121 . signed_duration_since ( pg_base_date_epoch ( ) . date ( ) )
2222 . num_days ( ) ;
2323 if n > ( i32:: MAX as i64 ) {
24- return Err ( Error :: new (
25- ErrorKind :: Other ,
26- format ! (
27- "value too large to store in the binary format (i32), actual: {}" ,
28- n
29- ) ,
30- )
24+ return Err ( Error :: other ( format ! (
25+ "value too large to store in the binary format (i32), actual: {}" ,
26+ n
27+ ) )
3128 . into ( ) ) ;
3229 }
3330
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl TimestampValue {
5252 . as_ref ( )
5353 . unwrap ( )
5454 . parse :: < Tz > ( )
55- . map_err ( |err| io:: Error :: new ( io :: ErrorKind :: Other , err. to_string ( ) ) ) ?;
55+ . map_err ( |err| io:: Error :: other ( err. to_string ( ) ) ) ?;
5656 let ndt = self . to_naive_datetime ( ) ;
5757 Ok ( tz. from_utc_datetime ( & ndt) )
5858 }
@@ -134,8 +134,7 @@ impl ToProtocolValue for TimestampValue {
134134 let n = ndt
135135 . signed_duration_since ( pg_base_date_epoch ( ) )
136136 . num_microseconds ( )
137- . ok_or ( Error :: new (
138- io:: ErrorKind :: Other ,
137+ . ok_or ( Error :: other (
139138 "Unable to extract number of seconds from timestamp" ,
140139 ) ) ?;
141140
You can’t perform that action at this time.
0 commit comments