Skip to content

Commit eb58be7

Browse files
committed
Implement IntoIterator for DatumList
Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
1 parent 1defc78 commit eb58be7

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/expr/src/scalar/func.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4954,7 +4954,7 @@ where
49544954
Uuid => Ok(strconv::format_uuid(buf, d.unwrap_uuid())),
49554955
Record { fields, .. } => {
49564956
let mut fields = fields.iter();
4957-
strconv::format_record(buf, &d.unwrap_list(), |buf, d| {
4957+
strconv::format_record(buf, d.unwrap_list(), |buf, d| {
49584958
let (_name, ty) = fields.next().unwrap();
49594959
if d.is_null() {
49604960
Ok(buf.write_null())
@@ -4966,7 +4966,7 @@ where
49664966
Array(elem_type) => strconv::format_array(
49674967
buf,
49684968
&d.unwrap_array().dims().into_iter().collect::<Vec<_>>(),
4969-
&d.unwrap_array().elements(),
4969+
d.unwrap_array().elements(),
49704970
|buf, d| {
49714971
if d.is_null() {
49724972
Ok(buf.write_null())
@@ -4975,7 +4975,7 @@ where
49754975
}
49764976
},
49774977
),
4978-
List { element_type, .. } => strconv::format_list(buf, &d.unwrap_list(), |buf, d| {
4978+
List { element_type, .. } => strconv::format_list(buf, d.unwrap_list(), |buf, d| {
49794979
if d.is_null() {
49804980
Ok(buf.write_null())
49814981
} else {
@@ -4989,7 +4989,7 @@ where
49894989
stringify_datum(buf.nonnull_buffer(), d, value_type)
49904990
}
49914991
}),
4992-
Int2Vector => strconv::format_legacy_vector(buf, &d.unwrap_array().elements(), |buf, d| {
4992+
Int2Vector => strconv::format_legacy_vector(buf, d.unwrap_array().elements(), |buf, d| {
49934993
stringify_datum(buf.nonnull_buffer(), d, &SqlScalarType::Int16)
49944994
}),
49954995
MzTimestamp { .. } => Ok(strconv::format_mz_timestamp(buf, d.unwrap_mz_timestamp())),

src/interchange/src/avro/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<'a> mz_avro::types::ToAvro for TypedDatum<'a> {
413413
let list = datum.unwrap_list();
414414
let fields = fields
415415
.iter()
416-
.zip_eq(&list)
416+
.zip_eq(list)
417417
.map(|((name, typ), datum)| {
418418
let name = name.to_string();
419419
let datum = TypedDatum::new(datum, typ);

src/interchange/src/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl ToJson for TypedDatum<'_> {
196196
let list = datum.unwrap_list();
197197
let fields: Map<String, serde_json::Value> = fields
198198
.iter()
199-
.zip_eq(&list)
199+
.zip_eq(list)
200200
.map(|((name, typ), datum)| {
201201
let name = name.to_string();
202202
let datum = TypedDatum::new(datum, typ);

src/repr/src/row.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,7 @@ impl<'a> DatumList<'a> {
26432643
}
26442644
}
26452645

2646-
impl<'a> IntoIterator for &'a DatumList<'a> {
2646+
impl<'a> IntoIterator for DatumList<'a> {
26472647
type Item = Datum<'a>;
26482648
type IntoIter = DatumListIter<'a>;
26492649
fn into_iter(self) -> DatumListIter<'a> {

src/repr/src/row/encode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl DatumColumnEncoder {
439439

440440
// Store the values of the array.
441441
let mut count = 0;
442-
for datum in &array.elements() {
442+
for datum in array.elements() {
443443
count += 1;
444444
vals.push(datum);
445445
}
@@ -458,7 +458,7 @@ impl DatumColumnEncoder {
458458
Datum::List(list),
459459
) => {
460460
let mut count = 0;
461-
for datum in &list {
461+
for datum in list {
462462
count += 1;
463463
values.push(datum);
464464
}

src/repr/src/scalar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,12 +1555,12 @@ impl fmt::Display for Datum<'_> {
15551555
f.write_str("=")?;
15561556
}
15571557
f.write_str("{")?;
1558-
write_delimited(f, ", ", &array.elements, |f, e| write!(f, "{}", e))?;
1558+
write_delimited(f, ", ", array.elements, |f, e| write!(f, "{}", e))?;
15591559
f.write_str("}")
15601560
}
15611561
Datum::List(list) => {
15621562
f.write_str("[")?;
1563-
write_delimited(f, ", ", list, |f, e| write!(f, "{}", e))?;
1563+
write_delimited(f, ", ", *list, |f, e| write!(f, "{}", e))?;
15641564
f.write_str("]")
15651565
}
15661566
Datum::Map(dict) => {

src/storage/src/decode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn render_decode_cdcv2<G: Scope<Timestamp = mz_repr::Timestamp>, FromTime: T
8989
let time = update.next().unwrap().unwrap_int64();
9090
let diff = Diff::from(update.next().unwrap().unwrap_int64());
9191

92-
row_buf.packer().extend(&data);
92+
row_buf.packer().extend(data);
9393
let data = row_buf.clone();
9494
let time = u64::try_from(time).expect("non-negative");
9595
let time = mz_repr::Timestamp::from(time);
@@ -100,17 +100,17 @@ pub fn render_decode_cdcv2<G: Scope<Timestamp = mz_repr::Timestamp>, FromTime: T
100100
(Datum::Null, Datum::List(progress)) => {
101101
let mut progress = progress.iter();
102102
let mut lower = vec![];
103-
for time in &progress.next().unwrap().unwrap_list() {
103+
for time in progress.next().unwrap().unwrap_list() {
104104
let time = u64::try_from(time.unwrap_int64()).expect("non-negative");
105105
lower.push(mz_repr::Timestamp::from(time));
106106
}
107107
let mut upper = vec![];
108-
for time in &progress.next().unwrap().unwrap_list() {
108+
for time in progress.next().unwrap().unwrap_list() {
109109
let time = u64::try_from(time.unwrap_int64()).expect("non-negative");
110110
upper.push(mz_repr::Timestamp::from(time));
111111
}
112112
let mut counts = vec![];
113-
for pair in &progress.next().unwrap().unwrap_list() {
113+
for pair in progress.next().unwrap().unwrap_list() {
114114
let mut pair = pair.unwrap_list().iter();
115115
let time = pair.next().unwrap().unwrap_int64();
116116
let count = pair.next().unwrap().unwrap_int64();

0 commit comments

Comments
 (0)