diff --git a/datafusion/common/src/column.rs b/datafusion/common/src/column.rs index c47ed28159064..d940bcf3146e3 100644 --- a/datafusion/common/src/column.rs +++ b/datafusion/common/src/column.rs @@ -109,21 +109,23 @@ impl Column { /// where `"foo.BAR"` would be parsed to a reference to column named `foo.BAR` pub fn from_qualified_name(flat_name: impl Into) -> Self { let flat_name = flat_name.into(); - Self::from_idents(&mut parse_identifiers_normalized(&flat_name, false)) - .unwrap_or_else(|| Self { + Self::from_idents(&mut parse_identifiers_normalized(&flat_name, false)).unwrap_or( + Self { relation: None, name: flat_name, - }) + }, + ) } /// Deserialize a fully qualified name string into a column preserving column text case pub fn from_qualified_name_ignore_case(flat_name: impl Into) -> Self { let flat_name = flat_name.into(); - Self::from_idents(&mut parse_identifiers_normalized(&flat_name, true)) - .unwrap_or_else(|| Self { + Self::from_idents(&mut parse_identifiers_normalized(&flat_name, true)).unwrap_or( + Self { relation: None, name: flat_name, - }) + }, + ) } /// return the column's name. diff --git a/datafusion/common/src/hash_utils.rs b/datafusion/common/src/hash_utils.rs index f1b3947f99761..0d1d93acf1fce 100644 --- a/datafusion/common/src/hash_utils.rs +++ b/datafusion/common/src/hash_utils.rs @@ -63,7 +63,7 @@ pub trait HashValue { fn hash_one(&self, state: &RandomState) -> u64; } -impl<'a, T: HashValue + ?Sized> HashValue for &'a T { +impl HashValue for &T { fn hash_one(&self, state: &RandomState) -> u64 { T::hash_one(self, state) } diff --git a/datafusion/common/src/utils/mod.rs b/datafusion/common/src/utils/mod.rs index d4c427aaa4a98..c4b6537be384d 100644 --- a/datafusion/common/src/utils/mod.rs +++ b/datafusion/common/src/utils/mod.rs @@ -569,7 +569,7 @@ pub mod datafusion_strsim { struct StringWrapper<'a>(&'a str); - impl<'a, 'b> IntoIterator for &'a StringWrapper<'b> { + impl<'b> IntoIterator for &StringWrapper<'b> { type Item = char; type IntoIter = Chars<'b>; diff --git a/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs b/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs index 9f089c7c0cea8..f3358bce7623b 100644 --- a/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs +++ b/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs @@ -60,7 +60,7 @@ pub struct AvroArrowArrayReader<'a, R: Read> { schema_lookup: BTreeMap, } -impl<'a, R: Read> AvroArrowArrayReader<'a, R> { +impl AvroArrowArrayReader<'_, R> { pub fn try_new( reader: R, schema: SchemaRef, diff --git a/datafusion/core/src/datasource/avro_to_arrow/reader.rs b/datafusion/core/src/datasource/avro_to_arrow/reader.rs index e6310cec7475d..dbc24da463667 100644 --- a/datafusion/core/src/datasource/avro_to_arrow/reader.rs +++ b/datafusion/core/src/datasource/avro_to_arrow/reader.rs @@ -128,7 +128,7 @@ pub struct Reader<'a, R: Read> { batch_size: usize, } -impl<'a, R: Read> Reader<'a, R> { +impl Reader<'_, R> { /// Create a new Avro Reader from any value that implements the `Read` trait. /// /// If reading a `File`, you can customise the Reader, such as to enable schema @@ -157,7 +157,7 @@ impl<'a, R: Read> Reader<'a, R> { } } -impl<'a, R: Read> Iterator for Reader<'a, R> { +impl Iterator for Reader<'_, R> { type Item = ArrowResult; /// Returns the next batch of results (defined by `self.batch_size`), or `None` if there diff --git a/datafusion/core/src/datasource/file_format/options.rs b/datafusion/core/src/datasource/file_format/options.rs index e392515cacb1a..95576f448c649 100644 --- a/datafusion/core/src/datasource/file_format/options.rs +++ b/datafusion/core/src/datasource/file_format/options.rs @@ -89,7 +89,7 @@ pub struct CsvReadOptions<'a> { pub file_sort_order: Vec>, } -impl<'a> Default for CsvReadOptions<'a> { +impl Default for CsvReadOptions<'_> { fn default() -> Self { Self::new() } @@ -243,7 +243,7 @@ pub struct ParquetReadOptions<'a> { pub file_sort_order: Vec>, } -impl<'a> Default for ParquetReadOptions<'a> { +impl Default for ParquetReadOptions<'_> { fn default() -> Self { Self { file_extension: DEFAULT_PARQUET_EXTENSION, @@ -323,7 +323,7 @@ pub struct ArrowReadOptions<'a> { pub table_partition_cols: Vec<(String, DataType)>, } -impl<'a> Default for ArrowReadOptions<'a> { +impl Default for ArrowReadOptions<'_> { fn default() -> Self { Self { schema: None, @@ -368,7 +368,7 @@ pub struct AvroReadOptions<'a> { pub table_partition_cols: Vec<(String, DataType)>, } -impl<'a> Default for AvroReadOptions<'a> { +impl Default for AvroReadOptions<'_> { fn default() -> Self { Self { schema: None, @@ -420,7 +420,7 @@ pub struct NdJsonReadOptions<'a> { pub file_sort_order: Vec>, } -impl<'a> Default for NdJsonReadOptions<'a> { +impl Default for NdJsonReadOptions<'_> { fn default() -> Self { Self { schema: None, diff --git a/datafusion/core/src/datasource/file_format/parquet.rs b/datafusion/core/src/datasource/file_format/parquet.rs index 787af4f531bd3..1d08de172273f 100644 --- a/datafusion/core/src/datasource/file_format/parquet.rs +++ b/datafusion/core/src/datasource/file_format/parquet.rs @@ -477,7 +477,7 @@ impl<'a> ObjectStoreFetch<'a> { } } -impl<'a> MetadataFetch for ObjectStoreFetch<'a> { +impl MetadataFetch for ObjectStoreFetch<'_> { fn fetch( &mut self, range: Range, diff --git a/datafusion/core/src/datasource/listing/helpers.rs b/datafusion/core/src/datasource/listing/helpers.rs index 04c64156b125b..a601aec32f162 100644 --- a/datafusion/core/src/datasource/listing/helpers.rs +++ b/datafusion/core/src/datasource/listing/helpers.rs @@ -135,7 +135,7 @@ pub fn split_files( partitioned_files.sort_by(|a, b| a.path().cmp(b.path())); // effectively this is div with rounding up instead of truncating - let chunk_size = (partitioned_files.len() + n - 1) / n; + let chunk_size = partitioned_files.len().div_ceil(n); let mut chunks = Vec::with_capacity(n); let mut current_chunk = Vec::with_capacity(chunk_size); for file in partitioned_files.drain(..) { diff --git a/datafusion/core/src/datasource/physical_plan/file_groups.rs b/datafusion/core/src/datasource/physical_plan/file_groups.rs index 28f975ae193d5..f9a19f1d96911 100644 --- a/datafusion/core/src/datasource/physical_plan/file_groups.rs +++ b/datafusion/core/src/datasource/physical_plan/file_groups.rs @@ -217,8 +217,7 @@ impl FileGroupPartitioner { return None; } - let target_partition_size = - (total_size as usize + (target_partitions) - 1) / (target_partitions); + let target_partition_size = (total_size as usize).div_ceil(target_partitions); let current_partition_index: usize = 0; let current_partition_size: usize = 0; diff --git a/datafusion/core/src/datasource/physical_plan/mod.rs b/datafusion/core/src/datasource/physical_plan/mod.rs index 2b50458bb5819..449b7bb435195 100644 --- a/datafusion/core/src/datasource/physical_plan/mod.rs +++ b/datafusion/core/src/datasource/physical_plan/mod.rs @@ -139,7 +139,7 @@ impl DisplayAs for FileScanConfig { #[derive(Debug)] struct FileGroupsDisplay<'a>(&'a [Vec]); -impl<'a> DisplayAs for FileGroupsDisplay<'a> { +impl DisplayAs for FileGroupsDisplay<'_> { fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult { let n_groups = self.0.len(); let groups = if n_groups == 1 { "group" } else { "groups" }; @@ -171,7 +171,7 @@ impl<'a> DisplayAs for FileGroupsDisplay<'a> { #[derive(Debug)] pub(crate) struct FileGroupDisplay<'a>(pub &'a [PartitionedFile]); -impl<'a> DisplayAs for FileGroupDisplay<'a> { +impl DisplayAs for FileGroupDisplay<'_> { fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult { write!(f, "[")?; match t { diff --git a/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs b/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs index 07f50bca1d1d3..4d0a8451a0d4e 100644 --- a/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs +++ b/datafusion/core/src/datasource/physical_plan/parquet/page_filter.rs @@ -449,7 +449,7 @@ impl<'a> PagesPruningStatistics<'a> { Some(vec) } } -impl<'a> PruningStatistics for PagesPruningStatistics<'a> { +impl PruningStatistics for PagesPruningStatistics<'_> { fn min_values(&self, _column: &datafusion_common::Column) -> Option { match self.converter.data_page_mins( self.column_index, diff --git a/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs b/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs index a97e7c7d2552c..af5ffb9d57435 100644 --- a/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs +++ b/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs @@ -336,7 +336,7 @@ impl<'schema> PushdownChecker<'schema> { } } -impl<'schema> TreeNodeRewriter for PushdownChecker<'schema> { +impl TreeNodeRewriter for PushdownChecker<'_> { type Node = Arc; fn f_down( diff --git a/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs b/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs index 7406676652f66..516310dc81ae6 100644 --- a/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs +++ b/datafusion/core/src/datasource/physical_plan/parquet/row_group_filter.rs @@ -374,7 +374,7 @@ impl<'a> RowGroupPruningStatistics<'a> { } } -impl<'a> PruningStatistics for RowGroupPruningStatistics<'a> { +impl PruningStatistics for RowGroupPruningStatistics<'_> { fn min_values(&self, column: &Column) -> Option { self.statistics_converter(column) .and_then(|c| Ok(c.row_group_mins(self.metadata_iter())?)) diff --git a/datafusion/core/src/execution/context/mod.rs b/datafusion/core/src/execution/context/mod.rs index 5f01d41c31e73..8ec834916424b 100644 --- a/datafusion/core/src/execution/context/mod.rs +++ b/datafusion/core/src/execution/context/mod.rs @@ -1764,7 +1764,7 @@ impl<'a> BadPlanVisitor<'a> { } } -impl<'n, 'a> TreeNodeVisitor<'n> for BadPlanVisitor<'a> { +impl<'n> TreeNodeVisitor<'n> for BadPlanVisitor<'_> { type Node = LogicalPlan; fn f_down(&mut self, node: &'n Self::Node) -> Result { diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rs index e99cf82223815..e2be3cf3749e1 100644 --- a/datafusion/core/src/execution/session_state.rs +++ b/datafusion/core/src/execution/session_state.rs @@ -1636,7 +1636,7 @@ struct SessionContextProvider<'a> { tables: HashMap>, } -impl<'a> ContextProvider for SessionContextProvider<'a> { +impl ContextProvider for SessionContextProvider<'_> { fn get_expr_planners(&self) -> &[Arc] { &self.state.expr_planners } @@ -1931,7 +1931,7 @@ impl<'a> SessionSimplifyProvider<'a> { } } -impl<'a> SimplifyInfo for SessionSimplifyProvider<'a> { +impl SimplifyInfo for SessionSimplifyProvider<'_> { fn is_boolean_type(&self, expr: &Expr) -> datafusion_common::Result { Ok(expr.get_type(self.df_schema)? == DataType::Boolean) } diff --git a/datafusion/expr-common/src/type_coercion/aggregates.rs b/datafusion/expr-common/src/type_coercion/aggregates.rs index 384d688cc27ed..13d52959aba65 100644 --- a/datafusion/expr-common/src/type_coercion/aggregates.rs +++ b/datafusion/expr-common/src/type_coercion/aggregates.rs @@ -294,19 +294,19 @@ pub fn coerce_avg_type(func_name: &str, arg_types: &[DataType]) -> Result Result { - return match &data_type { + match &data_type { DataType::Decimal128(p, s) => Ok(DataType::Decimal128(*p, *s)), DataType::Decimal256(p, s) => Ok(DataType::Decimal256(*p, *s)), d if d.is_numeric() => Ok(DataType::Float64), - DataType::Dictionary(_, v) => return coerced_type(func_name, v.as_ref()), + DataType::Dictionary(_, v) => coerced_type(func_name, v.as_ref()), _ => { - return plan_err!( + plan_err!( "The function {:?} does not support inputs of type {:?}.", func_name, data_type ) } - }; + } } Ok(vec![coerced_type(func_name, &arg_types[0])?]) } diff --git a/datafusion/functions-aggregate-common/src/merge_arrays.rs b/datafusion/functions-aggregate-common/src/merge_arrays.rs index 544bdc182829d..9b9a1240c1a19 100644 --- a/datafusion/functions-aggregate-common/src/merge_arrays.rs +++ b/datafusion/functions-aggregate-common/src/merge_arrays.rs @@ -65,7 +65,7 @@ impl<'a> CustomElement<'a> { // Overwrite ordering implementation such that // - `self.ordering` values are used for comparison, // - When used inside `BinaryHeap` it is a min-heap. -impl<'a> Ord for CustomElement<'a> { +impl Ord for CustomElement<'_> { fn cmp(&self, other: &Self) -> Ordering { // Compares according to custom ordering self.ordering(&self.ordering, &other.ordering) @@ -78,7 +78,7 @@ impl<'a> Ord for CustomElement<'a> { } } -impl<'a> PartialOrd for CustomElement<'a> { +impl PartialOrd for CustomElement<'_> { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } diff --git a/datafusion/functions-nested/src/planner.rs b/datafusion/functions-nested/src/planner.rs index 1929b8222a1b6..5ca51ac20f1e5 100644 --- a/datafusion/functions-nested/src/planner.rs +++ b/datafusion/functions-nested/src/planner.rs @@ -185,5 +185,5 @@ impl ExprPlanner for FieldAccessPlanner { } fn is_array_agg(agg_func: &datafusion_expr::expr::AggregateFunction) -> bool { - return agg_func.func.name() == "array_agg"; + agg_func.func.name() == "array_agg" } diff --git a/datafusion/functions/src/strings.rs b/datafusion/functions/src/strings.rs index e0cec3cb5756f..d2fb5d58519e5 100644 --- a/datafusion/functions/src/strings.rs +++ b/datafusion/functions/src/strings.rs @@ -395,7 +395,7 @@ pub enum ColumnarValueRef<'a> { NonNullableStringViewArray(&'a StringViewArray), } -impl<'a> ColumnarValueRef<'a> { +impl ColumnarValueRef<'_> { #[inline] pub fn is_valid(&self, i: usize) -> bool { match &self { diff --git a/datafusion/optimizer/src/analyzer/type_coercion.rs b/datafusion/optimizer/src/analyzer/type_coercion.rs index f088a6dc5691b..58e390ee8bdba 100644 --- a/datafusion/optimizer/src/analyzer/type_coercion.rs +++ b/datafusion/optimizer/src/analyzer/type_coercion.rs @@ -290,7 +290,7 @@ impl<'a> TypeCoercionRewriter<'a> { } } -impl<'a> TreeNodeRewriter for TypeCoercionRewriter<'a> { +impl TreeNodeRewriter for TypeCoercionRewriter<'_> { type Node = Expr; fn f_up(&mut self, expr: Expr) -> Result> { diff --git a/datafusion/optimizer/src/join_key_set.rs b/datafusion/optimizer/src/join_key_set.rs index c0eec78b183db..0a97173b30966 100644 --- a/datafusion/optimizer/src/join_key_set.rs +++ b/datafusion/optimizer/src/join_key_set.rs @@ -148,7 +148,7 @@ impl<'a> ExprPair<'a> { } } -impl<'a> Equivalent<(Expr, Expr)> for ExprPair<'a> { +impl Equivalent<(Expr, Expr)> for ExprPair<'_> { fn equivalent(&self, other: &(Expr, Expr)) -> bool { self.0 == &other.0 && self.1 == &other.1 } diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rs index 975150cd61220..b47ab9aa70701 100644 --- a/datafusion/optimizer/src/optimizer.rs +++ b/datafusion/optimizer/src/optimizer.rs @@ -302,7 +302,7 @@ impl<'a> Rewriter<'a> { } } -impl<'a> TreeNodeRewriter for Rewriter<'a> { +impl TreeNodeRewriter for Rewriter<'_> { type Node = LogicalPlan; fn f_down(&mut self, node: LogicalPlan) -> Result> { diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs index 6564e722eaf89..60de3f6b36736 100644 --- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs +++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs @@ -489,7 +489,7 @@ enum ConstSimplifyResult { SimplifyRuntimeError(DataFusionError, Expr), } -impl<'a> TreeNodeRewriter for ConstEvaluator<'a> { +impl TreeNodeRewriter for ConstEvaluator<'_> { type Node = Expr; fn f_down(&mut self, expr: Expr) -> Result> { @@ -710,7 +710,7 @@ impl<'a, S> Simplifier<'a, S> { } } -impl<'a, S: SimplifyInfo> TreeNodeRewriter for Simplifier<'a, S> { +impl TreeNodeRewriter for Simplifier<'_, S> { type Node = Expr; /// rewrite the expression simplifying any constant expressions diff --git a/datafusion/optimizer/src/simplify_expressions/guarantees.rs b/datafusion/optimizer/src/simplify_expressions/guarantees.rs index afcbe528083b8..4700ab97b5f39 100644 --- a/datafusion/optimizer/src/simplify_expressions/guarantees.rs +++ b/datafusion/optimizer/src/simplify_expressions/guarantees.rs @@ -57,7 +57,7 @@ impl<'a> GuaranteeRewriter<'a> { } } -impl<'a> TreeNodeRewriter for GuaranteeRewriter<'a> { +impl TreeNodeRewriter for GuaranteeRewriter<'_> { type Node = Expr; fn f_up(&mut self, expr: Expr) -> Result> { diff --git a/datafusion/physical-expr-common/src/physical_expr.rs b/datafusion/physical-expr-common/src/physical_expr.rs index aa816cfa4469e..8ab7030dd8a14 100644 --- a/datafusion/physical-expr-common/src/physical_expr.rs +++ b/datafusion/physical-expr-common/src/physical_expr.rs @@ -219,7 +219,7 @@ pub fn with_new_children_if_necessary( /// Example output: `[a + 1, b]` pub fn format_physical_expr_list(exprs: &[Arc]) -> impl Display + '_ { struct DisplayWrapper<'a>(&'a [Arc]); - impl<'a> Display for DisplayWrapper<'a> { + impl Display for DisplayWrapper<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let mut iter = self.0.iter(); write!(f, "[")?; diff --git a/datafusion/physical-expr-common/src/sort_expr.rs b/datafusion/physical-expr-common/src/sort_expr.rs index 9ae12fa9f608f..bf06296ba3e27 100644 --- a/datafusion/physical-expr-common/src/sort_expr.rs +++ b/datafusion/physical-expr-common/src/sort_expr.rs @@ -251,7 +251,7 @@ pub fn format_physical_sort_requirement_list( exprs: &[PhysicalSortRequirement], ) -> impl Display + '_ { struct DisplayWrapper<'a>(&'a [PhysicalSortRequirement]); - impl<'a> Display for DisplayWrapper<'a> { + impl Display for DisplayWrapper<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { let mut iter = self.0.iter(); write!(f, "[")?; diff --git a/datafusion/physical-expr/src/equivalence/class.rs b/datafusion/physical-expr/src/equivalence/class.rs index e4185ad44d65e..9e00b756b42a6 100644 --- a/datafusion/physical-expr/src/equivalence/class.rs +++ b/datafusion/physical-expr/src/equivalence/class.rs @@ -125,7 +125,7 @@ impl ConstExpr { /// Returns a [`Display`]able list of `ConstExpr`. pub fn format_list(input: &[ConstExpr]) -> impl Display + '_ { struct DisplayableList<'a>(&'a [ConstExpr]); - impl<'a> Display for DisplayableList<'a> { + impl Display for DisplayableList<'_> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { let mut first = true; for const_expr in self.0 { diff --git a/datafusion/physical-expr/src/expressions/in_list.rs b/datafusion/physical-expr/src/expressions/in_list.rs index 663045fcad3fb..29577740aab48 100644 --- a/datafusion/physical-expr/src/expressions/in_list.rs +++ b/datafusion/physical-expr/src/expressions/in_list.rs @@ -244,7 +244,7 @@ trait IsEqual: HashValue { fn is_equal(&self, other: &Self) -> bool; } -impl<'a, T: IsEqual + ?Sized> IsEqual for &'a T { +impl IsEqual for &T { fn is_equal(&self, other: &Self) -> bool { T::is_equal(self, other) } diff --git a/datafusion/physical-expr/src/utils/guarantee.rs b/datafusion/physical-expr/src/utils/guarantee.rs index 2c37c4d8b3940..75ad5d22afe6b 100644 --- a/datafusion/physical-expr/src/utils/guarantee.rs +++ b/datafusion/physical-expr/src/utils/guarantee.rs @@ -124,7 +124,7 @@ impl LiteralGuarantee { // for an `AND` conjunction to be true, all terms individually must be true .fold(GuaranteeBuilder::new(), |builder, expr| { if let Some(cel) = ColOpLit::try_new(expr) { - return builder.aggregate_conjunct(cel); + builder.aggregate_conjunct(cel) } else if let Some(inlist) = expr .as_any() .downcast_ref::() diff --git a/datafusion/physical-expr/src/utils/mod.rs b/datafusion/physical-expr/src/utils/mod.rs index e4b8b133a315f..c06efd5540985 100644 --- a/datafusion/physical-expr/src/utils/mod.rs +++ b/datafusion/physical-expr/src/utils/mod.rs @@ -146,9 +146,7 @@ struct PhysicalExprDAEGBuilder<'a, T, F: Fn(&ExprTreeNode) -> Result< constructor: &'a F, } -impl<'a, T, F: Fn(&ExprTreeNode) -> Result> - PhysicalExprDAEGBuilder<'a, T, F> -{ +impl) -> Result> PhysicalExprDAEGBuilder<'_, T, F> { // This method mutates an expression node by transforming it to a physical expression // and adding it to the graph. The method returns the mutated expression node. fn mutate( diff --git a/datafusion/physical-plan/src/display.rs b/datafusion/physical-plan/src/display.rs index 9f3a76e285777..9c5e95d56e600 100644 --- a/datafusion/physical-plan/src/display.rs +++ b/datafusion/physical-plan/src/display.rs @@ -124,7 +124,7 @@ impl<'a> DisplayableExecutionPlan<'a> { show_statistics: bool, show_schema: bool, } - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let mut visitor = IndentVisitor { t: self.format_type, @@ -163,7 +163,7 @@ impl<'a> DisplayableExecutionPlan<'a> { show_metrics: ShowMetrics, show_statistics: bool, } - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let t = DisplayFormatType::Default; @@ -202,7 +202,7 @@ impl<'a> DisplayableExecutionPlan<'a> { show_schema: bool, } - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let mut visitor = IndentVisitor { f, @@ -268,7 +268,7 @@ struct IndentVisitor<'a, 'b> { show_schema: bool, } -impl<'a, 'b> ExecutionPlanVisitor for IndentVisitor<'a, 'b> { +impl ExecutionPlanVisitor for IndentVisitor<'_, '_> { type Error = fmt::Error; fn pre_visit(&mut self, plan: &dyn ExecutionPlan) -> Result { write!(self.f, "{:indent$}", "", indent = self.indent * 2)?; @@ -349,7 +349,7 @@ impl ExecutionPlanVisitor for GraphvizVisitor<'_, '_> { struct Wrapper<'a>(&'a dyn ExecutionPlan, DisplayFormatType); - impl<'a> fmt::Display for Wrapper<'a> { + impl fmt::Display for Wrapper<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { self.0.fmt_as(self.1, f) } @@ -447,7 +447,7 @@ impl fmt::Display for VerboseDisplay { #[derive(Debug)] pub struct ProjectSchemaDisplay<'a>(pub &'a SchemaRef); -impl<'a> fmt::Display for ProjectSchemaDisplay<'a> { +impl fmt::Display for ProjectSchemaDisplay<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let parts: Vec<_> = self .0 diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rs index 8ab292c142697..f7bf039ee7b52 100644 --- a/datafusion/physical-plan/src/joins/hash_join.rs +++ b/datafusion/physical-plan/src/joins/hash_join.rs @@ -1560,7 +1560,7 @@ mod tests { use rstest_reuse::*; fn div_ceil(a: usize, b: usize) -> usize { - (a + b - 1) / b + a.div_ceil(b) } #[template] diff --git a/datafusion/physical-plan/src/metrics/value.rs b/datafusion/physical-plan/src/metrics/value.rs index 2eb01914ee0ac..decf77369db4f 100644 --- a/datafusion/physical-plan/src/metrics/value.rs +++ b/datafusion/physical-plan/src/metrics/value.rs @@ -313,7 +313,7 @@ pub struct ScopedTimerGuard<'a> { start: Option, } -impl<'a> ScopedTimerGuard<'a> { +impl ScopedTimerGuard<'_> { /// Stop the timer timing and record the time taken pub fn stop(&mut self) { if let Some(start) = self.start.take() { @@ -332,7 +332,7 @@ impl<'a> ScopedTimerGuard<'a> { } } -impl<'a> Drop for ScopedTimerGuard<'a> { +impl Drop for ScopedTimerGuard<'_> { fn drop(&mut self) { self.stop() } diff --git a/datafusion/physical-plan/src/repartition/distributor_channels.rs b/datafusion/physical-plan/src/repartition/distributor_channels.rs index 2e5ef24beac31..8d09c664fbb24 100644 --- a/datafusion/physical-plan/src/repartition/distributor_channels.rs +++ b/datafusion/physical-plan/src/repartition/distributor_channels.rs @@ -203,7 +203,7 @@ pub struct SendFuture<'a, T> { element: Box>, } -impl<'a, T> Future for SendFuture<'a, T> { +impl Future for SendFuture<'_, T> { type Output = Result<(), SendError>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -295,7 +295,7 @@ pub struct RecvFuture<'a, T> { rdy: bool, } -impl<'a, T> Future for RecvFuture<'a, T> { +impl Future for RecvFuture<'_, T> { type Output = Option; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs index 9a89db9a58933..906164f21b8c1 100644 --- a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs +++ b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs @@ -746,7 +746,7 @@ mod tests { // Split the provided record batch into multiple batch_size record batches fn split_batch(sorted: &RecordBatch, batch_size: usize) -> Vec { - let batches = (sorted.num_rows() + batch_size - 1) / batch_size; + let batches = sorted.num_rows().div_ceil(batch_size); // Split the sorted RecordBatch into multiple (0..batches) diff --git a/datafusion/physical-plan/src/sorts/streaming_merge.rs b/datafusion/physical-plan/src/sorts/streaming_merge.rs index 4350235ef47d1..2178cc012a10f 100644 --- a/datafusion/physical-plan/src/sorts/streaming_merge.rs +++ b/datafusion/physical-plan/src/sorts/streaming_merge.rs @@ -62,7 +62,7 @@ pub struct StreamingMergeBuilder<'a> { enable_round_robin_tie_breaker: bool, } -impl<'a> Default for StreamingMergeBuilder<'a> { +impl Default for StreamingMergeBuilder<'_> { fn default() -> Self { Self { streams: vec![], diff --git a/datafusion/sql/src/cte.rs b/datafusion/sql/src/cte.rs index c288d6ca70674..3650aea9c3c20 100644 --- a/datafusion/sql/src/cte.rs +++ b/datafusion/sql/src/cte.rs @@ -28,7 +28,7 @@ use datafusion_common::{ use datafusion_expr::{LogicalPlan, LogicalPlanBuilder, TableSource}; use sqlparser::ast::{Query, SetExpr, SetOperator, With}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn plan_with_clause( &self, with: With, diff --git a/datafusion/sql/src/expr/binary_op.rs b/datafusion/sql/src/expr/binary_op.rs index fcb57e8a82e4b..eaf28adf4ea8f 100644 --- a/datafusion/sql/src/expr/binary_op.rs +++ b/datafusion/sql/src/expr/binary_op.rs @@ -20,7 +20,7 @@ use datafusion_common::{not_impl_err, Result}; use datafusion_expr::Operator; use sqlparser::ast::BinaryOperator; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn parse_sql_binary_op(&self, op: BinaryOperator) -> Result { match op { BinaryOperator::Gt => Ok(Operator::Gt), diff --git a/datafusion/sql/src/expr/function.rs b/datafusion/sql/src/expr/function.rs index cb7255bb7873c..67fa23b869903 100644 --- a/datafusion/sql/src/expr/function.rs +++ b/datafusion/sql/src/expr/function.rs @@ -190,7 +190,7 @@ impl FunctionArgs { } } -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_function_to_expr( &self, function: SQLFunction, diff --git a/datafusion/sql/src/expr/grouping_set.rs b/datafusion/sql/src/expr/grouping_set.rs index a8b3ef7e20ec2..bedbf2a7d3470 100644 --- a/datafusion/sql/src/expr/grouping_set.rs +++ b/datafusion/sql/src/expr/grouping_set.rs @@ -21,7 +21,7 @@ use datafusion_common::{DFSchema, Result}; use datafusion_expr::{Expr, GroupingSet}; use sqlparser::ast::Expr as SQLExpr; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_grouping_sets_to_expr( &self, exprs: Vec>, diff --git a/datafusion/sql/src/expr/identifier.rs b/datafusion/sql/src/expr/identifier.rs index e103f68fc9275..9adf14459081e 100644 --- a/datafusion/sql/src/expr/identifier.rs +++ b/datafusion/sql/src/expr/identifier.rs @@ -28,7 +28,7 @@ use datafusion_expr::{Case, Expr}; use crate::planner::{ContextProvider, PlannerContext, SqlToRel}; use datafusion_expr::UNNAMED_TABLE; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_identifier_to_expr( &self, id: Ident, diff --git a/datafusion/sql/src/expr/mod.rs b/datafusion/sql/src/expr/mod.rs index a095d895b46fd..57ac96951f1f2 100644 --- a/datafusion/sql/src/expr/mod.rs +++ b/datafusion/sql/src/expr/mod.rs @@ -49,7 +49,7 @@ mod substring; mod unary_op; mod value; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn sql_expr_to_logical_expr( &self, sql: SQLExpr, diff --git a/datafusion/sql/src/expr/order_by.rs b/datafusion/sql/src/expr/order_by.rs index 00289806876fe..b7ed04326f40f 100644 --- a/datafusion/sql/src/expr/order_by.rs +++ b/datafusion/sql/src/expr/order_by.rs @@ -23,7 +23,7 @@ use datafusion_expr::expr::Sort; use datafusion_expr::{Expr, SortExpr}; use sqlparser::ast::{Expr as SQLExpr, OrderByExpr, Value}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Convert sql [OrderByExpr] to `Vec`. /// /// `input_schema` and `additional_schema` are used to resolve column references in the order-by expressions. diff --git a/datafusion/sql/src/expr/subquery.rs b/datafusion/sql/src/expr/subquery.rs index ff161c6ed644e..481f024787fef 100644 --- a/datafusion/sql/src/expr/subquery.rs +++ b/datafusion/sql/src/expr/subquery.rs @@ -24,7 +24,7 @@ use sqlparser::ast::Expr as SQLExpr; use sqlparser::ast::Query; use std::sync::Arc; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn parse_exists_subquery( &self, subquery: Query, diff --git a/datafusion/sql/src/expr/substring.rs b/datafusion/sql/src/expr/substring.rs index f58ab5ff3612c..59c78bc713cc4 100644 --- a/datafusion/sql/src/expr/substring.rs +++ b/datafusion/sql/src/expr/substring.rs @@ -22,7 +22,7 @@ use datafusion_expr::planner::PlannerResult; use datafusion_expr::Expr; use sqlparser::ast::Expr as SQLExpr; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_substring_to_expr( &self, expr: Box, diff --git a/datafusion/sql/src/expr/unary_op.rs b/datafusion/sql/src/expr/unary_op.rs index 06988eb03893b..a4096ec2355b0 100644 --- a/datafusion/sql/src/expr/unary_op.rs +++ b/datafusion/sql/src/expr/unary_op.rs @@ -23,7 +23,7 @@ use datafusion_expr::{ }; use sqlparser::ast::{Expr as SQLExpr, UnaryOperator, Value}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn parse_sql_unary_op( &self, op: UnaryOperator, diff --git a/datafusion/sql/src/expr/value.rs b/datafusion/sql/src/expr/value.rs index 1cf090aa64aa6..a651567abe22a 100644 --- a/datafusion/sql/src/expr/value.rs +++ b/datafusion/sql/src/expr/value.rs @@ -32,7 +32,7 @@ use sqlparser::ast::{BinaryOperator, Expr as SQLExpr, Interval, UnaryOperator, V use sqlparser::parser::ParserError::ParserError; use std::borrow::Cow; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn parse_value( &self, value: Value, diff --git a/datafusion/sql/src/query.rs b/datafusion/sql/src/query.rs index 740f9ad3b42c3..2e115d140ea80 100644 --- a/datafusion/sql/src/query.rs +++ b/datafusion/sql/src/query.rs @@ -29,7 +29,7 @@ use sqlparser::ast::{ SetExpr, }; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Generate a logical plan from an SQL query/subquery pub(crate) fn query_to_plan( &self, diff --git a/datafusion/sql/src/relation/join.rs b/datafusion/sql/src/relation/join.rs index 3f34608e37565..2ed1197e8fbfb 100644 --- a/datafusion/sql/src/relation/join.rs +++ b/datafusion/sql/src/relation/join.rs @@ -21,7 +21,7 @@ use datafusion_expr::{JoinType, LogicalPlan, LogicalPlanBuilder}; use sqlparser::ast::{Join, JoinConstraint, JoinOperator, TableFactor, TableWithJoins}; use std::collections::HashSet; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(crate) fn plan_table_with_joins( &self, t: TableWithJoins, diff --git a/datafusion/sql/src/relation/mod.rs b/datafusion/sql/src/relation/mod.rs index 256cc58e71dc4..45a617daae965 100644 --- a/datafusion/sql/src/relation/mod.rs +++ b/datafusion/sql/src/relation/mod.rs @@ -28,7 +28,7 @@ use sqlparser::ast::{FunctionArg, FunctionArgExpr, TableFactor}; mod join; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Create a `LogicalPlan` that scans the named relation fn create_relation( &self, diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rs index 12fc013a2ab80..39b6eb6e81327 100644 --- a/datafusion/sql/src/select.rs +++ b/datafusion/sql/src/select.rs @@ -45,7 +45,7 @@ use sqlparser::ast::{ }; use sqlparser::ast::{NamedWindowDefinition, Select, SelectItem, TableWithJoins}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Generate a logic plan from an SQL select pub(super) fn select_to_plan( &self, diff --git a/datafusion/sql/src/set_expr.rs b/datafusion/sql/src/set_expr.rs index e56ebb4d323f1..3b1201d3dd59b 100644 --- a/datafusion/sql/src/set_expr.rs +++ b/datafusion/sql/src/set_expr.rs @@ -21,7 +21,7 @@ use datafusion_expr::{LogicalPlan, LogicalPlanBuilder}; use recursive::recursive; use sqlparser::ast::{SetExpr, SetOperator, SetQuantifier}; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { #[recursive] pub(super) fn set_expr_to_plan( &self, diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs index 31b836f32b242..38695f98b5fe7 100644 --- a/datafusion/sql/src/statement.rs +++ b/datafusion/sql/src/statement.rs @@ -163,7 +163,7 @@ fn calc_inline_constraints_from_columns(columns: &[ColumnDef]) -> Vec SqlToRel<'a, S> { +impl SqlToRel<'_, S> { /// Generate a logical plan from an DataFusion SQL statement pub fn statement_to_plan(&self, statement: DFStatement) -> Result { match statement { diff --git a/datafusion/sql/src/unparser/mod.rs b/datafusion/sql/src/unparser/mod.rs index 83ae64ba238b0..2c2530ade7fb4 100644 --- a/datafusion/sql/src/unparser/mod.rs +++ b/datafusion/sql/src/unparser/mod.rs @@ -107,7 +107,7 @@ impl<'a> Unparser<'a> { } } -impl<'a> Default for Unparser<'a> { +impl Default for Unparser<'_> { fn default() -> Self { Self { dialect: &DefaultDialect {}, diff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rs index e479bdbacd839..e29a2299b41c4 100644 --- a/datafusion/sql/src/utils.rs +++ b/datafusion/sql/src/utils.rs @@ -328,7 +328,7 @@ struct RecursiveUnnestRewriter<'a> { columns_unnestings: &'a mut IndexMap>>, transformed_root_exprs: Option>, } -impl<'a> RecursiveUnnestRewriter<'a> { +impl RecursiveUnnestRewriter<'_> { /// This struct stores the history of expr /// during its tree-traversal with a notation of /// \[None,**Unnest(exprA)**,**Unnest(exprB)**,None,None\] @@ -416,7 +416,7 @@ impl<'a> RecursiveUnnestRewriter<'a> { } } -impl<'a> TreeNodeRewriter for RecursiveUnnestRewriter<'a> { +impl TreeNodeRewriter for RecursiveUnnestRewriter<'_> { type Node = Expr; /// This downward traversal needs to keep track of: diff --git a/datafusion/sql/src/values.rs b/datafusion/sql/src/values.rs index a4001bea7deac..dd8957c95470d 100644 --- a/datafusion/sql/src/values.rs +++ b/datafusion/sql/src/values.rs @@ -22,7 +22,7 @@ use datafusion_common::{DFSchema, Result}; use datafusion_expr::{LogicalPlan, LogicalPlanBuilder}; use sqlparser::ast::Values as SQLValues; -impl<'a, S: ContextProvider> SqlToRel<'a, S> { +impl SqlToRel<'_, S> { pub(super) fn sql_values_to_plan( &self, values: SQLValues,