Skip to content

Commit 5a8d177

Browse files
committed
chore: fix
1 parent b6a0642 commit 5a8d177

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff 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(_) => {

rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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()

rust/cubesql/pg-srv/src/buffer.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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!(

rust/cubesql/pg-srv/src/values/date.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff 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

rust/cubesql/pg-srv/src/values/timestamp.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)