Skip to content

Commit be1383e

Browse files
committed
fix(clippy): resolve warnings surfaced by Rust 1.95 clippy
- src/row_index.rs: drop redundant `.into_iter()` in `zip` (useless_conversion) - src/encoding/integer/rle_v2/delta.rs: rewrite two manual counter loops with `.enumerate()` (explicit_counter_loop) - tests/java_interop.rs: take `&Path` instead of `&PathBuf` in `run_meta` / `run_data` / `write_orc` (ptr_arg) Required to keep CI green on Rust 1.95.0 with `-D warnings`.
1 parent cc58bdb commit be1383e

3 files changed

Lines changed: 9 additions & 13 deletions

File tree

src/encoding/integer/rle_v2/delta.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,8 @@ mod tests {
250250
.unwrap();
251251

252252
let mut expected = vec![0, 10];
253-
let mut i = 1;
254-
for d in deltas {
255-
expected.push(d + expected[i]);
256-
i += 1;
253+
for (i, d) in deltas.into_iter().enumerate() {
254+
expected.push(d + expected[i + 1]);
257255
}
258256
assert_eq!(expected, out);
259257
}
@@ -279,10 +277,8 @@ mod tests {
279277
.unwrap();
280278

281279
let mut expected = vec![10_000, 9_999];
282-
let mut i = 1;
283-
for d in deltas {
284-
expected.push(expected[i] - d);
285-
i += 1;
280+
for (i, d) in deltas.into_iter().enumerate() {
281+
expected.push(expected[i + 1] - d);
286282
}
287283
assert_eq!(expected, out);
288284
}

src/row_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ pub fn parse_stripe_row_indexes(
280280
filters.len(),
281281
column_id
282282
);
283-
for (entry, bloom) in row_group_index.entries_mut().zip(filters.into_iter()) {
283+
for (entry, bloom) in row_group_index.entries_mut().zip(filters) {
284284
entry.bloom_filter = Some(bloom);
285285
}
286286
}

tests/java_interop.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
5353
use std::env;
5454
use std::io::Write;
55-
use std::path::PathBuf;
55+
use std::path::{Path, PathBuf};
5656
use std::process::Command;
5757
use std::sync::Arc;
5858

@@ -94,7 +94,7 @@ fn orc_tools_jar() -> Option<PathBuf> {
9494
}
9595

9696
/// Run `java -jar <jar> meta <file>` and return stdout+stderr.
97-
fn run_meta(jar: &PathBuf, orc_path: &PathBuf) -> (bool, String, String) {
97+
fn run_meta(jar: &Path, orc_path: &Path) -> (bool, String, String) {
9898
let out = Command::new("java")
9999
.args([
100100
"-jar",
@@ -112,7 +112,7 @@ fn run_meta(jar: &PathBuf, orc_path: &PathBuf) -> (bool, String, String) {
112112
}
113113

114114
/// Run `java -jar <jar> data <file>` and return stdout+stderr.
115-
fn run_data(jar: &PathBuf, orc_path: &PathBuf) -> (bool, String, String) {
115+
fn run_data(jar: &Path, orc_path: &Path) -> (bool, String, String) {
116116
let out = Command::new("java")
117117
.args([
118118
"-jar",
@@ -130,7 +130,7 @@ fn run_data(jar: &PathBuf, orc_path: &PathBuf) -> (bool, String, String) {
130130
}
131131

132132
/// Write `batch` as an ORC file with `codec` to `path`.
133-
fn write_orc(path: &PathBuf, batch: &RecordBatch, codec: Compression) {
133+
fn write_orc(path: &Path, batch: &RecordBatch, codec: Compression) {
134134
let file = std::fs::File::create(path).expect("create orc tempfile");
135135
let mut writer = ArrowWriterBuilder::new(file, batch.schema())
136136
.with_compression(codec)

0 commit comments

Comments
 (0)