Skip to content

Commit 0ef85f4

Browse files
committed
Fix Clippy warnings
1 parent 0c008a7 commit 0ef85f4

Some content is hidden

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

62 files changed

+261
-283
lines changed

data-access/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub enum ListEntry {
3434
}
3535

3636
/// The path and size of the file.
37-
#[derive(Debug, Clone, PartialEq)]
37+
#[derive(Debug, Clone, PartialEq, Eq)]
3838
pub struct SizedFile {
3939
/// Path of the file. It is relative to the current object
4040
/// store (it does not specify the `xx://` scheme).
@@ -46,7 +46,7 @@ pub struct SizedFile {
4646
/// Description of a file as returned by the listing command of a
4747
/// given object store. The resulting path is relative to the
4848
/// object store that generated it.
49-
#[derive(Debug, Clone, PartialEq)]
49+
#[derive(Debug, Clone, PartialEq, Eq)]
5050
pub struct FileMeta {
5151
/// The path and size of the file.
5252
pub sized_file: SizedFile,

datafusion-examples/examples/dataframe_in_memory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ async fn main() -> Result<()> {
3838
let batch = RecordBatch::try_new(
3939
schema.clone(),
4040
vec![
41-
Arc::new(StringArray::from_slice(&["a", "b", "c", "d"])),
42-
Arc::new(Int32Array::from_slice(&[1, 10, 10, 100])),
41+
Arc::new(StringArray::from_slice(["a", "b", "c", "d"])),
42+
Arc::new(Int32Array::from_slice([1, 10, 10, 100])),
4343
],
4444
)?;
4545

datafusion-examples/examples/simple_udaf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ fn create_context() -> Result<SessionContext> {
3737
// define data in two partitions
3838
let batch1 = RecordBatch::try_new(
3939
schema.clone(),
40-
vec![Arc::new(Float32Array::from_slice(&[2.0, 4.0, 8.0]))],
40+
vec![Arc::new(Float32Array::from_slice([2.0, 4.0, 8.0]))],
4141
)?;
4242
let batch2 = RecordBatch::try_new(
4343
schema.clone(),
44-
vec![Arc::new(Float32Array::from_slice(&[64.0]))],
44+
vec![Arc::new(Float32Array::from_slice([64.0]))],
4545
)?;
4646

4747
// declare a new context. In spark API, this corresponds to a new spark SQLsession

datafusion-examples/examples/simple_udf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ fn create_context() -> Result<SessionContext> {
4343
let batch = RecordBatch::try_new(
4444
schema.clone(),
4545
vec![
46-
Arc::new(Float32Array::from_slice(&[2.1, 3.1, 4.1, 5.1])),
47-
Arc::new(Float64Array::from_slice(&[1.0, 2.0, 3.0, 4.0])),
46+
Arc::new(Float32Array::from_slice([2.1, 3.1, 4.1, 5.1])),
47+
Arc::new(Float64Array::from_slice([1.0, 2.0, 3.0, 4.0])),
4848
],
4949
)?;
5050

datafusion/common/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ mod test {
200200

201201
/// Model what happens when implementing SendableRecrordBatchStream:
202202
/// DataFusion code needs to return an ArrowError
203-
#[allow(clippy::try_err)]
203+
#[allow(clippy::try_err, clippy::let_unit_value)]
204204
fn return_arrow_error() -> arrow::error::Result<()> {
205205
// Expect the '?' to work
206206
let _foo = Err(DataFusionError::Plan("foo".to_string()))?;
@@ -209,7 +209,7 @@ mod test {
209209

210210
/// Model what happens when using arrow kernels in DataFusion
211211
/// code: need to turn an ArrowError into a DataFusionError
212-
#[allow(clippy::try_err)]
212+
#[allow(clippy::try_err, clippy::let_unit_value)]
213213
fn return_datafusion_error() -> crate::error::Result<()> {
214214
// Expect the '?' to work
215215
let _bar = Err(ArrowError::SchemaError("bar".to_string()))?;

datafusion/common/src/scalar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,10 @@ impl ScalarValue {
552552
if precision <= DECIMAL_MAX_PRECISION && scale <= precision {
553553
return Ok(ScalarValue::Decimal128(Some(value), precision, scale));
554554
}
555-
return Err(DataFusionError::Internal(format!(
555+
Err(DataFusionError::Internal(format!(
556556
"Can not new a decimal type ScalarValue for precision {} and scale {}",
557557
precision, scale
558-
)));
558+
)))
559559
}
560560
/// Getter for the `DataType` of the value
561561
pub fn get_datatype(&self) -> DataType {

datafusion/core/src/datasource/datasource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::physical_plan::ExecutionPlan;
2929

3030
/// Indicates whether and how a filter expression can be handled by a
3131
/// TableProvider for table scans.
32-
#[derive(Debug, Clone, PartialEq)]
32+
#[derive(Debug, Clone, PartialEq, Eq)]
3333
pub enum TableProviderFilterPushDown {
3434
/// The expression cannot be used by the provider.
3535
Unsupported,
@@ -45,7 +45,7 @@ pub enum TableProviderFilterPushDown {
4545
}
4646

4747
/// Indicates the type of this table for metadata/catalog purposes.
48-
#[derive(Debug, Clone, Copy, PartialEq)]
48+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4949
pub enum TableType {
5050
/// An ordinary physical table.
5151
Base,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl ListingTableConfig {
118118
DataFusionError::Internal("Unable to infer file suffix".into())
119119
})?;
120120

121-
let format = ListingTableConfig::infer_format(*file_type)?;
121+
let format = ListingTableConfig::infer_format(file_type)?;
122122

123123
let listing_options = ListingOptions {
124124
format,

datafusion/core/src/datasource/memory.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ mod tests {
166166
let batch = RecordBatch::try_new(
167167
schema.clone(),
168168
vec![
169-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
170-
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
171-
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
169+
Arc::new(Int32Array::from_slice([1, 2, 3])),
170+
Arc::new(Int32Array::from_slice([4, 5, 6])),
171+
Arc::new(Int32Array::from_slice([7, 8, 9])),
172172
Arc::new(Int32Array::from(vec![None, None, Some(9)])),
173173
],
174174
)?;
@@ -200,9 +200,9 @@ mod tests {
200200
let batch = RecordBatch::try_new(
201201
schema.clone(),
202202
vec![
203-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
204-
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
205-
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
203+
Arc::new(Int32Array::from_slice([1, 2, 3])),
204+
Arc::new(Int32Array::from_slice([4, 5, 6])),
205+
Arc::new(Int32Array::from_slice([7, 8, 9])),
206206
],
207207
)?;
208208

@@ -228,9 +228,9 @@ mod tests {
228228
let batch = RecordBatch::try_new(
229229
schema.clone(),
230230
vec![
231-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
232-
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
233-
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
231+
Arc::new(Int32Array::from_slice([1, 2, 3])),
232+
Arc::new(Int32Array::from_slice([4, 5, 6])),
233+
Arc::new(Int32Array::from_slice([7, 8, 9])),
234234
],
235235
)?;
236236

@@ -268,9 +268,9 @@ mod tests {
268268
let batch = RecordBatch::try_new(
269269
schema1,
270270
vec![
271-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
272-
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
273-
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
271+
Arc::new(Int32Array::from_slice([1, 2, 3])),
272+
Arc::new(Int32Array::from_slice([4, 5, 6])),
273+
Arc::new(Int32Array::from_slice([7, 8, 9])),
274274
],
275275
)?;
276276

@@ -301,8 +301,8 @@ mod tests {
301301
let batch = RecordBatch::try_new(
302302
schema1,
303303
vec![
304-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
305-
Arc::new(Int32Array::from_slice(&[7, 5, 9])),
304+
Arc::new(Int32Array::from_slice([1, 2, 3])),
305+
Arc::new(Int32Array::from_slice([7, 5, 9])),
306306
],
307307
)?;
308308

@@ -346,18 +346,18 @@ mod tests {
346346
let batch1 = RecordBatch::try_new(
347347
Arc::new(schema1),
348348
vec![
349-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
350-
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
351-
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
349+
Arc::new(Int32Array::from_slice([1, 2, 3])),
350+
Arc::new(Int32Array::from_slice([4, 5, 6])),
351+
Arc::new(Int32Array::from_slice([7, 8, 9])),
352352
],
353353
)?;
354354

355355
let batch2 = RecordBatch::try_new(
356356
Arc::new(schema2),
357357
vec![
358-
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
359-
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
360-
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
358+
Arc::new(Int32Array::from_slice([1, 2, 3])),
359+
Arc::new(Int32Array::from_slice([4, 5, 6])),
360+
Arc::new(Int32Array::from_slice([7, 8, 9])),
361361
],
362362
)?;
363363

datafusion/core/src/datasource/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub async fn get_statistics_with_limit(
103103

104104
let column_stats = if has_statistics {
105105
Some(get_col_stats(
106-
&*file_schema,
106+
&file_schema,
107107
null_counts,
108108
&mut max_values,
109109
&mut min_values,

0 commit comments

Comments
 (0)