diff --git a/rust/datafusion/src/execution/context.rs b/rust/datafusion/src/execution/context.rs index 3660fff7a5b7..ee28f2ed9f6d 100644 --- a/rust/datafusion/src/execution/context.rs +++ b/rust/datafusion/src/execution/context.rs @@ -386,7 +386,7 @@ impl ExecutionContext { .map(|batch| writer.write(&batch?)) .try_collect() .await - .map_err(|e| DataFusionError::from(e))?; + .map_err(DataFusionError::from)?; } Ok(()) } @@ -415,7 +415,7 @@ impl ExecutionContext { .map(|batch| writer.write(&batch?)) .try_collect() .await - .map_err(|e| DataFusionError::from(e))?; + .map_err(DataFusionError::from)?; writer.close()?; } diff --git a/rust/datafusion/src/lib.rs b/rust/datafusion/src/lib.rs index 9f2979b93e3c..27ba041dd9c9 100644 --- a/rust/datafusion/src/lib.rs +++ b/rust/datafusion/src/lib.rs @@ -40,10 +40,6 @@ clippy::new_without_default, clippy::or_fun_call, clippy::ptr_arg, - clippy::redundant_field_names, - clippy::redundant_static_lifetimes, - clippy::redundant_pattern_matching, - clippy::redundant_closure, clippy::single_match, clippy::stable_sort_primitive, clippy::type_complexity, diff --git a/rust/datafusion/src/logical_plan/builder.rs b/rust/datafusion/src/logical_plan/builder.rs index 37b82b1a808b..ca3d8ed6cce1 100644 --- a/rust/datafusion/src/logical_plan/builder.rs +++ b/rust/datafusion/src/logical_plan/builder.rs @@ -97,8 +97,7 @@ impl LogicalPlanBuilder { let projected_schema = projection .clone() .map(|p| Schema::new(p.iter().map(|i| schema.field(*i).clone()).collect())); - let projected_schema = - projected_schema.map_or(schema.clone(), |s| SchemaRef::new(s)); + let projected_schema = projected_schema.map_or(schema.clone(), SchemaRef::new); Ok(Self::from(&LogicalPlan::ParquetScan { path: path.to_owned(), @@ -120,7 +119,7 @@ impl LogicalPlanBuilder { Schema::new(p.iter().map(|i| table_schema.field(*i).clone()).collect()) }); let projected_schema = - projected_schema.map_or(table_schema.clone(), |s| SchemaRef::new(s)); + projected_schema.map_or(table_schema.clone(), SchemaRef::new); Ok(Self::from(&LogicalPlan::TableScan { schema_name: schema_name.to_owned(), diff --git a/rust/datafusion/src/optimizer/projection_push_down.rs b/rust/datafusion/src/optimizer/projection_push_down.rs index e06a605e5562..ac653065cc0d 100644 --- a/rust/datafusion/src/optimizer/projection_push_down.rs +++ b/rust/datafusion/src/optimizer/projection_push_down.rs @@ -263,7 +263,7 @@ fn optimize_plan( source: source.clone(), table_schema: table_schema.clone(), projection: Some(projection), - projected_schema: projected_schema, + projected_schema, }) } LogicalPlan::InMemoryScan { @@ -282,7 +282,7 @@ fn optimize_plan( data: data.clone(), schema: schema.clone(), projection: Some(projection), - projected_schema: projected_schema, + projected_schema, }) } LogicalPlan::CsvScan { @@ -306,7 +306,7 @@ fn optimize_plan( schema: schema.clone(), delimiter: *delimiter, projection: Some(projection), - projected_schema: projected_schema, + projected_schema, }) } LogicalPlan::ParquetScan { @@ -326,7 +326,7 @@ fn optimize_plan( path: path.to_owned(), schema: schema.clone(), projection: Some(projection), - projected_schema: projected_schema, + projected_schema, }) } LogicalPlan::Explain { diff --git a/rust/datafusion/src/physical_plan/aggregates.rs b/rust/datafusion/src/physical_plan/aggregates.rs index eba8c7552a4b..78d1d10358e9 100644 --- a/rust/datafusion/src/physical_plan/aggregates.rs +++ b/rust/datafusion/src/physical_plan/aggregates.rs @@ -163,7 +163,7 @@ pub fn create_aggregate_expr( }) } -static NUMERICS: &'static [DataType] = &[ +static NUMERICS: &[DataType] = &[ DataType::Int8, DataType::Int16, DataType::Int32, diff --git a/rust/datafusion/src/physical_plan/array_expressions.rs b/rust/datafusion/src/physical_plan/array_expressions.rs index 528cbb3da8d4..7bdb742fd714 100644 --- a/rust/datafusion/src/physical_plan/array_expressions.rs +++ b/rust/datafusion/src/physical_plan/array_expressions.rs @@ -91,7 +91,7 @@ pub fn array(args: &[ArrayRef]) -> Result { /// Currently supported types by the array function. /// The order of these types correspond to the order on which coercion applies /// This should thus be from least informative to most informative -pub static SUPPORTED_ARRAY_TYPES: &'static [DataType] = &[ +pub static SUPPORTED_ARRAY_TYPES: &[DataType] = &[ DataType::Boolean, DataType::UInt8, DataType::UInt16, diff --git a/rust/datafusion/src/physical_plan/common.rs b/rust/datafusion/src/physical_plan/common.rs index 7c4f21790240..3c63a447e961 100644 --- a/rust/datafusion/src/physical_plan/common.rs +++ b/rust/datafusion/src/physical_plan/common.rs @@ -84,7 +84,7 @@ pub async fn collect(stream: SendableRecordBatchStream) -> Result>() .await - .map_err(|e| DataFusionError::from(e)) + .map_err(DataFusionError::from) } /// Recursively build a list of files in a directory with a given extension diff --git a/rust/datafusion/src/physical_plan/expressions.rs b/rust/datafusion/src/physical_plan/expressions.rs index d82c63b30831..9b82cfc30522 100644 --- a/rust/datafusion/src/physical_plan/expressions.rs +++ b/rust/datafusion/src/physical_plan/expressions.rs @@ -1594,7 +1594,7 @@ pub fn nullif_func(args: &[ArrayRef]) -> Result { /// Currently supported types by the nullif function. /// The order of these types correspond to the order on which coercion applies /// This should thus be from least informative to most informative -pub static SUPPORTED_NULLIF_TYPES: &'static [DataType] = &[ +pub static SUPPORTED_NULLIF_TYPES: &[DataType] = &[ DataType::Boolean, DataType::UInt8, DataType::UInt16, diff --git a/rust/datafusion/src/physical_plan/functions.rs b/rust/datafusion/src/physical_plan/functions.rs index 56fe2c5060cb..d296512ffdb4 100644 --- a/rust/datafusion/src/physical_plan/functions.rs +++ b/rust/datafusion/src/physical_plan/functions.rs @@ -455,7 +455,7 @@ mod tests { #[test] fn test_concat_error() -> Result<()> { let result = return_type(&BuiltinScalarFunction::Concat, &vec![]); - if let Ok(_) = result { + if result.is_ok() { Err(DataFusionError::Plan( "Function 'concat' cannot accept zero arguments".to_string(), )) diff --git a/rust/datafusion/src/physical_plan/planner.rs b/rust/datafusion/src/physical_plan/planner.rs index 20e1a29c009a..46bfb846b4be 100644 --- a/rust/datafusion/src/physical_plan/planner.rs +++ b/rust/datafusion/src/physical_plan/planner.rs @@ -599,7 +599,7 @@ impl DefaultPhysicalPlanner { ) -> Result { Ok(PhysicalSortExpr { expr: self.create_physical_expr(e, input_schema, ctx_state)?, - options: options, + options, }) } } diff --git a/rust/datafusion/src/physical_plan/type_coercion.rs b/rust/datafusion/src/physical_plan/type_coercion.rs index 728dd81538e8..55e24a71472a 100644 --- a/rust/datafusion/src/physical_plan/type_coercion.rs +++ b/rust/datafusion/src/physical_plan/type_coercion.rs @@ -346,7 +346,7 @@ mod tests { ]; for case in cases { - if let Ok(_) = coerce(&case.0, &case.1, &case.2) { + if coerce(&case.0, &case.1, &case.2).is_ok() { return Err(DataFusionError::Plan(format!( "Error was expected in {:?}", case