Skip to content

Commit f068b6f

Browse files
askalt0x501D
authored andcommitted
clippy: apply suggestions
1 parent 13974c2 commit f068b6f

Some content is hidden

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

84 files changed

+135
-128
lines changed

datafusion-cli/tests/cli_integration.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17+
#![allow(unexpected_cfgs)]
1718

1819
use std::process::Command;
1920

datafusion/catalog/src/catalog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ use datafusion_common::Result;
100100
/// [`UnityCatalogProvider`]: https://github.com/delta-io/delta-rs/blob/951436ecec476ce65b5ed3b58b50fb0846ca7b91/crates/deltalake-core/src/data_catalog/unity/datafusion.rs#L111-L123
101101
///
102102
/// [`TableProvider`]: crate::TableProvider
103-
103+
///
104104
pub trait CatalogProvider: Sync + Send {
105105
/// Returns the catalog provider as [`Any`]
106106
/// so that it can be downcast to a specific implementation.

datafusion/common/src/pyarrow.rs

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ mod tests {
111111
})
112112
}
113113

114+
#[allow(unexpected_cfgs)]
114115
#[test]
115116
fn test_roundtrip() {
116117
init_python();
@@ -134,6 +135,7 @@ mod tests {
134135
});
135136
}
136137

138+
#[allow(unexpected_cfgs)]
137139
#[test]
138140
fn test_py_scalar() {
139141
init_python();

datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct AvroArrowArrayReader<'a, R: Read> {
6060
schema_lookup: BTreeMap<String, usize>,
6161
}
6262

63-
impl<'a, R: Read> AvroArrowArrayReader<'a, R> {
63+
impl<R: Read> AvroArrowArrayReader<'_, R> {
6464
pub fn try_new(
6565
reader: R,
6666
schema: SchemaRef,

datafusion/core/src/datasource/avro_to_arrow/reader.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub struct Reader<'a, R: Read> {
128128
batch_size: usize,
129129
}
130130

131-
impl<'a, R: Read> Reader<'a, R> {
131+
impl<R: Read> Reader<'_, R> {
132132
/// Create a new Avro Reader from any value that implements the `Read` trait.
133133
///
134134
/// 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> {
157157
}
158158
}
159159

160-
impl<'a, R: Read> Iterator for Reader<'a, R> {
160+
impl<R: Read> Iterator for Reader<'_, R> {
161161
type Item = ArrowResult<RecordBatch>;
162162

163163
/// Returns the next batch of results (defined by `self.batch_size`), or `None` if there

datafusion/core/tests/core_integration.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17+
#![allow(unexpected_cfgs)]
1718

1819
/// Run all tests that are found in the `sql` directory
1920
mod sql;

datafusion/core/tests/fuzz.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17+
#![allow(unexpected_cfgs)]
1718

1819
/// Run all tests that are found in the `fuzz_cases` directory
1920
mod fuzz_cases;

datafusion/core/tests/memory_limit/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717

1818
//! This module contains tests for limiting memory at runtime in DataFusion
19+
#![allow(unexpected_cfgs)]
1920

2021
use arrow::datatypes::{Int32Type, SchemaRef};
2122
use arrow::record_batch::RecordBatch;

datafusion/core/tests/optimizer/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
//! Tests for the DataFusion SQL query planner that require functions from the
1919
//! datafusion-functions crate.
20+
#![allow(unexpected_cfgs)]
2021

2122
use std::any::Any;
2223
use std::collections::HashMap;

datafusion/core/tests/parquet/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17+
#![allow(unexpected_cfgs)]
1718

1819
//! Parquet integration tests
1920
use crate::parquet::utils::MetricsFinder;

datafusion/core/tests/user_defined_integration.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17+
#![allow(unexpected_cfgs)]
1718

1819
/// Run all tests that are found in the `user_defined` directory
1920
mod user_defined;

datafusion/execution/src/cache/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub mod cache_unit;
2222
/// This interface does not get `mut` references and thus has to handle its own
2323
/// locking via internal mutability. It can be accessed via multiple concurrent queries
2424
/// during planning and execution.
25-
25+
///
2626
pub trait CacheAccessor<K, V>: Send + Sync {
2727
// Extra info but not part of the cache key or cache value.
2828
type Extra: Clone;

datafusion/execution/src/metrics/value.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ pub struct ScopedTimerGuard<'a> {
313313
start: Option<Instant>,
314314
}
315315

316-
impl<'a> ScopedTimerGuard<'a> {
316+
impl ScopedTimerGuard<'_> {
317317
/// Stop the timer timing and record the time taken
318318
pub fn stop(&mut self) {
319319
if let Some(start) = self.start.take() {
@@ -332,7 +332,7 @@ impl<'a> ScopedTimerGuard<'a> {
332332
}
333333
}
334334

335-
impl<'a> Drop for ScopedTimerGuard<'a> {
335+
impl Drop for ScopedTimerGuard<'_> {
336336
fn drop(&mut self) {
337337
self.stop()
338338
}

datafusion/expr/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ macro_rules! expr_vec_fmt {
18651865
}
18661866

18671867
struct SchemaDisplay<'a>(&'a Expr);
1868-
impl<'a> Display for SchemaDisplay<'a> {
1868+
impl Display for SchemaDisplay<'_> {
18691869
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
18701870
match self.0 {
18711871
// The same as Display

datafusion/expr/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
// Make cheap clones clear: https://github.com/apache/datafusion/issues/11143
1818
#![deny(clippy::clone_on_ref_ptr)]
19+
#![allow(unexpected_cfgs)]
1920

2021
//! [DataFusion](https://github.com/apache/datafusion)
2122
//! is an extensible query execution framework that uses

datafusion/expr/src/logical_plan/ddl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl DdlStatement {
122122
/// See [crate::LogicalPlan::display] for an example
123123
pub fn display(&self) -> impl fmt::Display + '_ {
124124
struct Wrapper<'a>(&'a DdlStatement);
125-
impl<'a> Display for Wrapper<'a> {
125+
impl Display for Wrapper<'_> {
126126
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
127127
match self.0 {
128128
DdlStatement::CreateExternalTable(CreateExternalTable {

datafusion/expr/src/logical_plan/display.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'b> IndentVisitor<'a, 'b> {
5858
}
5959
}
6060

61-
impl<'n, 'a, 'b> TreeNodeVisitor<'n> for IndentVisitor<'a, 'b> {
61+
impl<'n> TreeNodeVisitor<'n> for IndentVisitor<'_, '_> {
6262
type Node = LogicalPlan;
6363

6464
fn f_down(
@@ -112,7 +112,7 @@ impl<'n, 'a, 'b> TreeNodeVisitor<'n> for IndentVisitor<'a, 'b> {
112112
pub fn display_schema(schema: &Schema) -> impl fmt::Display + '_ {
113113
struct Wrapper<'a>(&'a Schema);
114114

115-
impl<'a> fmt::Display for Wrapper<'a> {
115+
impl fmt::Display for Wrapper<'_> {
116116
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
117117
write!(f, "[")?;
118118
for (idx, field) in self.0.fields().iter().enumerate() {
@@ -180,7 +180,7 @@ impl<'a, 'b> GraphvizVisitor<'a, 'b> {
180180
}
181181
}
182182

183-
impl<'n, 'a, 'b> TreeNodeVisitor<'n> for GraphvizVisitor<'a, 'b> {
183+
impl<'n> TreeNodeVisitor<'n> for GraphvizVisitor<'_, '_> {
184184
type Node = LogicalPlan;
185185

186186
fn f_down(
@@ -659,7 +659,7 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
659659
}
660660
}
661661

662-
impl<'n, 'a, 'b> TreeNodeVisitor<'n> for PgJsonVisitor<'a, 'b> {
662+
impl<'n> TreeNodeVisitor<'n> for PgJsonVisitor<'_, '_> {
663663
type Node = LogicalPlan;
664664

665665
fn f_down(

datafusion/expr/src/logical_plan/plan.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ impl LogicalPlan {
15301530
// Boilerplate structure to wrap LogicalPlan with something
15311531
// that that can be formatted
15321532
struct Wrapper<'a>(&'a LogicalPlan);
1533-
impl<'a> Display for Wrapper<'a> {
1533+
impl Display for Wrapper<'_> {
15341534
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
15351535
let with_schema = false;
15361536
let mut visitor = IndentVisitor::new(f, with_schema);
@@ -1573,7 +1573,7 @@ impl LogicalPlan {
15731573
// Boilerplate structure to wrap LogicalPlan with something
15741574
// that that can be formatted
15751575
struct Wrapper<'a>(&'a LogicalPlan);
1576-
impl<'a> Display for Wrapper<'a> {
1576+
impl Display for Wrapper<'_> {
15771577
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
15781578
let with_schema = true;
15791579
let mut visitor = IndentVisitor::new(f, with_schema);
@@ -1593,7 +1593,7 @@ impl LogicalPlan {
15931593
// Boilerplate structure to wrap LogicalPlan with something
15941594
// that that can be formatted
15951595
struct Wrapper<'a>(&'a LogicalPlan);
1596-
impl<'a> Display for Wrapper<'a> {
1596+
impl Display for Wrapper<'_> {
15971597
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
15981598
let mut visitor = PgJsonVisitor::new(f);
15991599
visitor.with_schema(true);
@@ -1639,7 +1639,7 @@ impl LogicalPlan {
16391639
// Boilerplate structure to wrap LogicalPlan with something
16401640
// that that can be formatted
16411641
struct Wrapper<'a>(&'a LogicalPlan);
1642-
impl<'a> Display for Wrapper<'a> {
1642+
impl Display for Wrapper<'_> {
16431643
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
16441644
let mut visitor = GraphvizVisitor::new(f);
16451645

@@ -1690,7 +1690,7 @@ impl LogicalPlan {
16901690
// Boilerplate structure to wrap LogicalPlan with something
16911691
// that that can be formatted
16921692
struct Wrapper<'a>(&'a LogicalPlan);
1693-
impl<'a> Display for Wrapper<'a> {
1693+
impl Display for Wrapper<'_> {
16941694
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
16951695
match self.0 {
16961696
LogicalPlan::EmptyRelation(_) => write!(f, "EmptyRelation"),

datafusion/expr/src/logical_plan/statement.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Statement {
6262
/// See [crate::LogicalPlan::display] for an example
6363
pub fn display(&self) -> impl fmt::Display + '_ {
6464
struct Wrapper<'a>(&'a Statement);
65-
impl<'a> Display for Wrapper<'a> {
65+
impl Display for Wrapper<'_> {
6666
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6767
match self.0 {
6868
Statement::TransactionStart(TransactionStart {

datafusion/expr/src/simplify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a> SimplifyContext<'a> {
7171
}
7272
}
7373

74-
impl<'a> SimplifyInfo for SimplifyContext<'a> {
74+
impl SimplifyInfo for SimplifyContext<'_> {
7575
/// returns true if this Expr has boolean type
7676
fn is_boolean_type(&self, expr: &Expr) -> Result<bool> {
7777
if let Some(schema) = &self.schema {

datafusion/expr/src/udwf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl WindowUDFImpl for AliasedWindowUDFImpl {
504504
let inner = self.inner.resolve_placeholders(param_values)?;
505505
Ok(if let Some(inner) = inner {
506506
Some(Arc::new(Self {
507-
inner: inner,
507+
inner,
508508
aliases: self.aliases.clone(),
509509
}))
510510
} else {

datafusion/functions-aggregate-common/src/merge_arrays.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'a> CustomElement<'a> {
6565
// Overwrite ordering implementation such that
6666
// - `self.ordering` values are used for comparison,
6767
// - When used inside `BinaryHeap` it is a min-heap.
68-
impl<'a> Ord for CustomElement<'a> {
68+
impl Ord for CustomElement<'_> {
6969
fn cmp(&self, other: &Self) -> Ordering {
7070
// Compares according to custom ordering
7171
self.ordering(&self.ordering, &other.ordering)
@@ -78,7 +78,7 @@ impl<'a> Ord for CustomElement<'a> {
7878
}
7979
}
8080

81-
impl<'a> PartialOrd for CustomElement<'a> {
81+
impl PartialOrd for CustomElement<'_> {
8282
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
8383
Some(self.cmp(other))
8484
}

datafusion/functions-nested/src/concat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn concat_internal<O: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
321321
Ok(Arc::new(list_arr))
322322
}
323323

324-
/// Kernal functions
324+
// Kernal functions
325325

326326
/// Array_append SQL function
327327
pub(crate) fn array_append_inner(args: &[ArrayRef]) -> Result<ArrayRef> {

datafusion/functions-nested/src/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ fn get_element_type(data_type: &DataType) -> Result<&DataType> {
306306
/// | +-------+ | | +-------+ |
307307
/// +-----------+ +-----------+
308308
/// ```text
309-
309+
///
310310
fn make_map_array_internal<O: OffsetSizeTrait>(
311311
keys: ArrayRef,
312312
values: ArrayRef,

datafusion/functions-nested/src/planner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,5 @@ impl ExprPlanner for FieldAccessPlanner {
184184
}
185185

186186
fn is_array_agg(agg_func: &datafusion_expr::expr::AggregateFunction) -> bool {
187-
return agg_func.func.name() == "array_agg";
187+
agg_func.func.name() == "array_agg"
188188
}

datafusion/functions/src/string/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub(crate) enum ColumnarValueRef<'a> {
259259
NonNullableStringViewArray(&'a StringViewArray),
260260
}
261261

262-
impl<'a> ColumnarValueRef<'a> {
262+
impl ColumnarValueRef<'_> {
263263
#[inline]
264264
pub fn is_valid(&self, i: usize) -> bool {
265265
match &self {

datafusion/optimizer/src/analyzer/type_coercion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'a> TypeCoercionRewriter<'a> {
257257
}
258258
}
259259

260-
impl<'a> TreeNodeRewriter for TypeCoercionRewriter<'a> {
260+
impl TreeNodeRewriter for TypeCoercionRewriter<'_> {
261261
type Node = Expr;
262262

263263
fn f_up(&mut self, expr: Expr) -> Result<Transformed<Expr>> {

datafusion/optimizer/src/join_key_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a> ExprPair<'a> {
148148
}
149149
}
150150

151-
impl<'a> Equivalent<(Expr, Expr)> for ExprPair<'a> {
151+
impl Equivalent<(Expr, Expr)> for ExprPair<'_> {
152152
fn equivalent(&self, other: &(Expr, Expr)) -> bool {
153153
self.0 == &other.0 && self.1 == &other.1
154154
}

datafusion/optimizer/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
// Make cheap clones clear: https://github.com/apache/datafusion/issues/11143
1818
#![deny(clippy::clone_on_ref_ptr)]
19+
#![allow(unexpected_cfgs)]
1920

2021
//! # DataFusion Optimizer
2122
//!

datafusion/optimizer/src/optimizer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use crate::utils::log_plan;
6969
///
7070
/// [`AnalyzerRule`]: crate::analyzer::AnalyzerRule
7171
/// [`SessionState::add_optimizer_rule`]: https://docs.rs/datafusion/latest/datafusion/execution/session_state/struct.SessionState.html#method.add_optimizer_rule
72-
72+
///
7373
pub trait OptimizerRule {
7474
/// Try and rewrite `plan` to an optimized form, returning None if the plan
7575
/// cannot be optimized by this rule.
@@ -308,7 +308,7 @@ impl<'a> Rewriter<'a> {
308308
}
309309
}
310310

311-
impl<'a> TreeNodeRewriter for Rewriter<'a> {
311+
impl TreeNodeRewriter for Rewriter<'_> {
312312
type Node = LogicalPlan;
313313

314314
fn f_down(&mut self, node: LogicalPlan) -> Result<Transformed<LogicalPlan>> {

datafusion/optimizer/src/replace_distinct_aggregate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use datafusion_expr::{Aggregate, Distinct, DistinctOn, Expr, LogicalPlan};
5252
/// )
5353
/// ORDER BY a DESC
5454
/// ```
55-
55+
///
5656
/// Optimizer that replaces logical [[Distinct]] with a logical [[Aggregate]]
5757
#[derive(Default)]
5858
pub struct ReplaceDistinctWithAggregate {}

datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ enum ConstSimplifyResult {
484484
SimplifyRuntimeError(DataFusionError, Expr),
485485
}
486486

487-
impl<'a> TreeNodeRewriter for ConstEvaluator<'a> {
487+
impl TreeNodeRewriter for ConstEvaluator<'_> {
488488
type Node = Expr;
489489

490490
fn f_down(&mut self, expr: Expr) -> Result<Transformed<Expr>> {
@@ -705,7 +705,7 @@ impl<'a, S> Simplifier<'a, S> {
705705
}
706706
}
707707

708-
impl<'a, S: SimplifyInfo> TreeNodeRewriter for Simplifier<'a, S> {
708+
impl<S: SimplifyInfo> TreeNodeRewriter for Simplifier<'_, S> {
709709
type Node = Expr;
710710

711711
/// rewrite the expression simplifying any constant expressions

0 commit comments

Comments
 (0)