Skip to content

Commit 5ee2547

Browse files
authored
Fix style issues caught by newer rust and clippy (#3368)
While I was debugging an unrelated issue I tried compiling our repo with latest nightly and it found some new style issues that should be addressed. I quite like that it calls out unnecessary transmute if safe versions exist Signed-off-by: Robert Kruszewski <[email protected]> Signed-off-by: Robert Kruszewski <[email protected]>
1 parent 60a4c54 commit 5ee2547

File tree

68 files changed

+176
-212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+176
-212
lines changed

bench-vortex/src/bin/clickbench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn print_results(
329329
fn data_source_base_url(remote_data_dir: &Option<String>, flavor: Flavor) -> anyhow::Result<Url> {
330330
match remote_data_dir {
331331
None => {
332-
let basepath = format!("clickbench_{}", flavor).to_data_path();
332+
let basepath = format!("clickbench_{flavor}").to_data_path();
333333
let client = reqwest::blocking::Client::default();
334334

335335
flavor.download(&client, basepath.as_path())?;

bench-vortex/src/bin/public_bi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn main() -> anyhow::Result<()> {
176176
.sorted_for_display()
177177
.iter()
178178
{
179-
println!("{}", m);
179+
println!("{m}");
180180
}
181181
}
182182
}

bench-vortex/src/bin/tpch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ async fn bench_main(
434434
}
435435
}
436436
_ => {
437-
warn!("Engine {:?} not supported for TPC-H benchmarks", engine);
437+
warn!("Engine {engine:?} not supported for TPC-H benchmarks");
438438
}
439439
}
440440
}
@@ -447,7 +447,7 @@ async fn bench_main(
447447
metrics = metrics.aggregate();
448448
}
449449
for m in metrics.timestamps_removed().sorted_for_display().iter() {
450-
println!("{}", m);
450+
println!("{m}");
451451
}
452452
render_table(measurements, &targets)?;
453453
}

bench-vortex/src/compress/bench.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ pub fn benchmark_compress(
9191
});
9292
vortex_compress_time = Some(time);
9393
timings.push(CompressionTimingMeasurement {
94-
name: format!("compress time/{}", bench_name),
94+
name: format!("compress time/{bench_name}"),
9595
time,
9696
format: Format::OnDiskVortex,
9797
});
9898
progress.inc(1);
9999

100100
let compressed_size_f64 = compressed_size.load(Ordering::SeqCst) as f64;
101101
ratios.push(CustomUnitMeasurement {
102-
name: format!("vortex size/{}", bench_name),
102+
name: format!("vortex size/{bench_name}"),
103103
format: Format::OnDiskVortex,
104104
unit: Cow::from("bytes"),
105105
value: compressed_size_f64,
@@ -123,22 +123,22 @@ pub fn benchmark_compress(
123123
});
124124
parquet_compress_time = Some(time);
125125
timings.push(CompressionTimingMeasurement {
126-
name: format!("compress time/{}", bench_name),
126+
name: format!("compress time/{bench_name}"),
127127
time,
128128
format: Format::Parquet,
129129
});
130130

131131
progress.inc(1);
132132
let parquet_compressed_size = parquet_compressed_size.into_inner();
133133
ratios.push(CustomUnitMeasurement {
134-
name: format!("parquet-zstd size/{}", bench_name),
134+
name: format!("parquet-zstd size/{bench_name}"),
135135
// unlike timings, ratios have a single column vortex
136136
format: Format::OnDiskVortex,
137137
unit: Cow::from("bytes"),
138138
value: parquet_compressed_size as f64,
139139
});
140140
ratios.push(CustomUnitMeasurement {
141-
name: format!("vortex:parquet-zstd size/{}", bench_name),
141+
name: format!("vortex:parquet-zstd size/{bench_name}"),
142142
format: Format::OnDiskVortex,
143143
unit: Cow::from("ratio"),
144144
value: compressed_size.load(Ordering::SeqCst) as f64 / parquet_compressed_size as f64,
@@ -161,7 +161,7 @@ pub fn benchmark_compress(
161161
});
162162
vortex_decompress_time = Some(time);
163163
timings.push(CompressionTimingMeasurement {
164-
name: format!("decompress time/{}", bench_name),
164+
name: format!("decompress time/{bench_name}"),
165165
time,
166166
format: Format::OnDiskVortex,
167167
});
@@ -188,7 +188,7 @@ pub fn benchmark_compress(
188188
});
189189
parquet_decompress_time = Some(time);
190190
timings.push(CompressionTimingMeasurement {
191-
name: format!("decompress time/{}", bench_name),
191+
name: format!("decompress time/{bench_name}"),
192192
time,
193193
format: Format::Parquet,
194194
});
@@ -197,7 +197,7 @@ pub fn benchmark_compress(
197197

198198
if let Some((vortex, parquet)) = vortex_compress_time.zip(parquet_compress_time) {
199199
ratios.push(CustomUnitMeasurement {
200-
name: format!("vortex:parquet-zstd ratio compress time/{}", bench_name),
200+
name: format!("vortex:parquet-zstd ratio compress time/{bench_name}"),
201201
format: Format::OnDiskVortex,
202202
unit: Cow::from("ratio"),
203203
value: vortex.as_nanos() as f64 / parquet.as_nanos() as f64,
@@ -206,7 +206,7 @@ pub fn benchmark_compress(
206206

207207
if let Some((vortex, parquet)) = vortex_decompress_time.zip(parquet_decompress_time) {
208208
ratios.push(CustomUnitMeasurement {
209-
name: format!("vortex:parquet-zstd ratio decompress time/{}", bench_name),
209+
name: format!("vortex:parquet-zstd ratio decompress time/{bench_name}"),
210210
format: Format::OnDiskVortex,
211211
unit: Cow::from("ratio"),
212212
value: vortex.as_nanos() as f64 / parquet.as_nanos() as f64,

bench-vortex/src/engines/ddb/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub fn register_tables(
271271
object,
272272
));
273273

274-
trace!("register duckdb tables with command: {:?}", command);
274+
trace!("register duckdb tables with command: {command:?}");
275275

276276
// Pass along OS env vars (for aws creds)
277277
// Don't trace env vars.
@@ -318,7 +318,7 @@ pub fn execute_query(
318318
.arg("-c")
319319
.arg(query);
320320

321-
trace!("execute duckdb query with command: {:?}", command);
321+
trace!("execute duckdb query with command: {command:?}");
322322

323323
let time_instant = Instant::now();
324324
let output = command.output()?;

bench-vortex/src/engines/df/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub fn make_object_store(
8484
.build()
8585
.unwrap(),
8686
);
87-
df.register_object_store(&Url::parse(&format!("s3://{}/", bucket_name))?, s3.clone());
87+
df.register_object_store(&Url::parse(&format!("s3://{bucket_name}/"))?, s3.clone());
8888
Ok(s3)
8989
}
9090
"gs" => {
@@ -95,7 +95,7 @@ pub fn make_object_store(
9595
.build()
9696
.unwrap(),
9797
);
98-
df.register_object_store(&Url::parse(&format!("gs://{}/", bucket_name))?, gcs.clone());
98+
df.register_object_store(&Url::parse(&format!("gs://{bucket_name}/"))?, gcs.clone());
9999
Ok(gcs)
100100
}
101101
_ => {
@@ -130,7 +130,7 @@ pub fn write_execution_plan(
130130
) {
131131
fs::write(
132132
format!("{dataset_name}_{format}_q{query_idx:02}.plan"),
133-
format!("{:#?}", execution_plan),
133+
format!("{execution_plan:#?}"),
134134
)
135135
.expect("Unable to write file");
136136

bench-vortex/src/measurements.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ pub enum MeasurementValue {
2727
impl Display for MeasurementValue {
2828
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
2929
match self {
30-
MeasurementValue::Int(i) => write!(f, "{}", i),
30+
MeasurementValue::Int(i) => write!(f, "{i}"),
3131
MeasurementValue::Float(fl) => match f.precision() {
32-
None => write!(f, "{}", fl),
33-
Some(p) => write!(f, "{1:.*}", p, fl),
32+
None => write!(f, "{fl}"),
33+
Some(p) => write!(f, "{fl:.p$}"),
3434
},
3535
}
3636
}

bench-vortex/src/tpcds/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn tpcds_queries() -> impl Iterator<Item = (usize, String)> {
2424
fn tpch_query(query_idx: usize) -> String {
2525
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"))
2626
.join("tpcds")
27-
.join(format!("{:02}", query_idx))
27+
.join(format!("{query_idx:02}"))
2828
.with_extension("sql");
2929
fs::read_to_string(manifest_dir).unwrap()
3030
}

bench-vortex/src/tpch/dbgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl Display for Platform {
153153
Platform::MacOS => "macos",
154154
Platform::Linux => "linux",
155155
};
156-
write!(f, "{}", str)
156+
write!(f, "{str}")
157157
}
158158
}
159159

bench-vortex/src/tpch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub fn tpch_queries() -> impl Iterator<Item = (usize, Vec<String>)> {
289289
fn tpch_query(query_idx: usize) -> Vec<String> {
290290
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"))
291291
.join("tpch")
292-
.join(format!("q{}", query_idx))
292+
.join(format!("q{query_idx}"))
293293
.with_extension("sql");
294294
fs::read_to_string(manifest_dir)
295295
.unwrap()

0 commit comments

Comments
 (0)