Skip to content

Commit aee4741

Browse files
committed
fix clippy
1 parent cd27e18 commit aee4741

File tree

28 files changed

+43
-49
lines changed

28 files changed

+43
-49
lines changed

benchmarks/src/bin/tpch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async fn benchmark_query(
247247
}
248248

249249
let elapsed = start.elapsed().as_secs_f64() * 1000.0;
250-
millis.push(elapsed as f64);
250+
millis.push(elapsed);
251251
let row_count = result.iter().map(|b| b.num_rows()).sum();
252252
println!(
253253
"Query {} iteration {} took {:.1} ms and returned {} rows",

datafusion/core/benches/data_utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn create_record_batch(
131131
schema,
132132
vec![
133133
Arc::new(StringArray::from(keys)),
134-
Arc::new(Float32Array::from_slice(&vec![i as f32; batch_size])),
134+
Arc::new(Float32Array::from_slice(vec![i as f32; batch_size])),
135135
Arc::new(Float64Array::from(values)),
136136
Arc::new(UInt64Array::from(integer_values_wide)),
137137
Arc::new(UInt64Array::from(integer_values_narrow)),

datafusion/core/benches/filter_query_sql.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ fn create_context(array_len: usize, batch_size: usize) -> Result<SessionContext>
4949
RecordBatch::try_new(
5050
schema.clone(),
5151
vec![
52-
Arc::new(Float32Array::from_slice(&vec![i as f32; batch_size])),
53-
Arc::new(Float64Array::from_slice(&vec![i as f64; batch_size])),
52+
Arc::new(Float32Array::from_slice(vec![i as f32; batch_size])),
53+
Arc::new(Float64Array::from_slice(vec![i as f64; batch_size])),
5454
],
5555
)
5656
.unwrap()

datafusion/core/benches/math_query_sql.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ fn create_context(
6161
RecordBatch::try_new(
6262
schema.clone(),
6363
vec![
64-
Arc::new(Float32Array::from_slice(&vec![i as f32; batch_size])),
65-
Arc::new(Float64Array::from_slice(&vec![i as f64; batch_size])),
64+
Arc::new(Float32Array::from_slice(vec![i as f32; batch_size])),
65+
Arc::new(Float64Array::from_slice(vec![i as f64; batch_size])),
6666
],
6767
)
6868
.unwrap()

datafusion/core/src/catalog/information_schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl SchemaProvider for InformationSchemaProvider {
264264
}
265265

266266
fn table_exist(&self, name: &str) -> bool {
267-
return matches!(name.to_ascii_lowercase().as_str(), TABLES | VIEWS | COLUMNS);
267+
matches!(name.to_ascii_lowercase().as_str(), TABLES | VIEWS | COLUMNS)
268268
}
269269
}
270270

datafusion/core/src/datasource/listing/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod tests {
235235
let root = std::env::current_dir().unwrap();
236236
let root = root.to_string_lossy();
237237

238-
let url = ListingTableUrl::parse(&root).unwrap();
238+
let url = ListingTableUrl::parse(root).unwrap();
239239
let child = url.prefix.child("partition").child("file");
240240

241241
let prefix: Vec<_> = url.strip_prefix(&child).unwrap().collect();

datafusion/core/src/datasource/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ pub async fn get_statistics_with_limit(
125125
};
126126

127127
let statistics = Statistics {
128-
num_rows: Some(num_rows as usize),
129-
total_byte_size: Some(total_byte_size as usize),
128+
num_rows: Some(num_rows),
129+
total_byte_size: Some(total_byte_size),
130130
column_statistics: column_stats,
131131
is_exact,
132132
};
@@ -167,7 +167,7 @@ fn get_col_stats(
167167
None => None,
168168
};
169169
ColumnStatistics {
170-
null_count: Some(null_counts[i] as usize),
170+
null_count: Some(null_counts[i]),
171171
max_value,
172172
min_value,
173173
distinct_count: None,

datafusion/core/src/execution/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ impl SessionState {
16301630
Some(host) => format!("{}://{}", url.scheme(), host),
16311631
None => format!("{}://", url.scheme()),
16321632
};
1633-
let path = &url.as_str()[authority.len() as usize..];
1633+
let path = &url.as_str()[authority.len()..];
16341634
let path = object_store::path::Path::parse(path).expect("Can't parse path");
16351635
let store = ObjectStoreUrl::parse(authority.as_str())
16361636
.expect("Invalid default catalog url");
@@ -2649,7 +2649,7 @@ mod tests {
26492649
// generate a partitioned file
26502650
for partition in 0..partition_count {
26512651
let filename = format!("partition-{}.{}", partition, file_extension);
2652-
let file_path = tmp_dir.path().join(&filename);
2652+
let file_path = tmp_dir.path().join(filename);
26532653
let mut file = File::create(file_path)?;
26542654

26552655
// generate some data

datafusion/core/src/physical_plan/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ mod tests {
328328
RecordBatch::try_new(
329329
Arc::clone(&schema),
330330
vec![
331-
Arc::new(Float32Array::from_slice(&vec![i as f32; batch_size])),
332-
Arc::new(Float64Array::from_slice(&vec![i as f64; batch_size])),
331+
Arc::new(Float32Array::from_slice(vec![i as f32; batch_size])),
332+
Arc::new(Float64Array::from_slice(vec![i as f64; batch_size])),
333333
],
334334
)
335335
.unwrap()

datafusion/core/src/physical_plan/file_format/csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ pub async fn plan_to_csv(
252252
for i in 0..plan.output_partitioning().partition_count() {
253253
let plan = plan.clone();
254254
let filename = format!("part-{}.csv", i);
255-
let path = fs_path.join(&filename);
255+
let path = fs_path.join(filename);
256256
let file = fs::File::create(path)?;
257257
let mut writer = csv::Writer::new(file);
258258
let task_ctx = Arc::new(TaskContext::from(state));
@@ -539,7 +539,7 @@ mod tests {
539539
// generate a partitioned file
540540
for partition in 0..partition_count {
541541
let filename = format!("partition-{}.{}", partition, file_extension);
542-
let file_path = tmp_dir.path().join(&filename);
542+
let file_path = tmp_dir.path().join(filename);
543543
let mut file = File::create(file_path)?;
544544

545545
// generate some data

0 commit comments

Comments
 (0)