Skip to content

Commit 41f7137

Browse files
authored
chore: enforce clippy::allow_attributes for physical crates (#19185)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Part of #18881. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> Please refer to #18881. ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> + Added `#![deny(clippy::allow_attributes)]` to the following crates: + `datafusion-physical-expr-adapter`. + `datafusion-physical-expr-common`. + `datafusion-physical-optimizer`. + Removed `#[allow(deprecated)]` from https://github.com/apache/datafusion/blob/cb2f3d2a86f15aa857b8a297277d9c79a36bd6e8/datafusion/physical-optimizer/src/filter_pushdown.rs#L432-L443 as [lint is only fulfilled on usage of `#[deprecated]` items](https://doc.rust-lang.org/reference/attributes/diagnostics.html#r-attributes.diagnostics.deprecated.intro), thus when `#[expect(deprecated)]` is used instead of `#[allow(deprecated)]` it results in `error: this lint expectation is unfulfilled`. + Kept `#[allow(clippy::only_used_in_recursion)]` in https://github.com/apache/datafusion/blob/6746007826ebd3fcb5614bf87183674435bbb134/datafusion/physical-optimizer/src/aggregate_statistics.rs#L43-L98 as `#[expect(clippy::only_used_in_recursion)]` resulted in `error: this lint expectation is unfulfilled` when running `sh ci/scripts/rust_clippy.sh` but was successful when running `cargo clippy -p datafusion-physical-optimizer -- -D warning`. Ref: #18881 (comment). For now, easiest solution is to locally expect `#[expect(clippy::allow_attributes)]`. ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> Successfully ran `sh ci/scripts/rust_clippy.sh`. ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> No.
1 parent fc6d0a4 commit 41f7137

File tree

15 files changed

+18
-12
lines changed

15 files changed

+18
-12
lines changed

datafusion/physical-expr-adapter/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
2222
)]
2323
#![cfg_attr(docsrs, feature(doc_cfg))]
24+
// https://github.com/apache/datafusion/issues/18881
25+
#![deny(clippy::allow_attributes)]
2426

2527
//! Physical expression schema adaptation utilities for DataFusion
2628

datafusion/physical-expr-common/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
// https://github.com/apache/datafusion/issues/11143
2525
#![deny(clippy::clone_on_ref_ptr)]
2626
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
27+
// https://github.com/apache/datafusion/issues/18881
28+
#![deny(clippy::allow_attributes)]
2729

2830
//! Physical Expr Common packages for [DataFusion]
2931
//! This package contains high level PhysicalExpr trait

datafusion/physical-optimizer/src/aggregate_statistics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ use crate::{OptimizerContext, PhysicalOptimizerRule};
3333
pub struct AggregateStatistics {}
3434

3535
impl AggregateStatistics {
36-
#[allow(missing_docs)]
36+
#[expect(missing_docs)]
3737
pub fn new() -> Self {
3838
Self {}
3939
}
4040
}
4141

4242
impl PhysicalOptimizerRule for AggregateStatistics {
4343
#[cfg_attr(feature = "recursive_protection", recursive::recursive)]
44+
#[expect(clippy::allow_attributes)] // See https://github.com/apache/datafusion/issues/18881#issuecomment-3621545670
4445
#[allow(clippy::only_used_in_recursion)] // See https://github.com/rust-lang/rust-clippy/issues/14566
4546
fn optimize_plan(
4647
&self,

datafusion/physical-optimizer/src/coalesce_batches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
3838
pub struct CoalesceBatches {}
3939

4040
impl CoalesceBatches {
41-
#[allow(missing_docs)]
41+
#[expect(missing_docs)]
4242
pub fn new() -> Self {
4343
Self::default()
4444
}

datafusion/physical-optimizer/src/combine_partial_final_agg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use datafusion_physical_expr::{physical_exprs_equal, PhysicalExpr};
3939
pub struct CombinePartialFinalAggregate {}
4040

4141
impl CombinePartialFinalAggregate {
42-
#[allow(missing_docs)]
42+
#[expect(missing_docs)]
4343
pub fn new() -> Self {
4444
Self {}
4545
}

datafusion/physical-optimizer/src/enforce_distribution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ use itertools::izip;
184184
pub struct EnforceDistribution {}
185185

186186
impl EnforceDistribution {
187-
#[allow(missing_docs)]
187+
#[expect(missing_docs)]
188188
pub fn new() -> Self {
189189
Self {}
190190
}

datafusion/physical-optimizer/src/enforce_sorting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ use itertools::izip;
7979
pub struct EnforceSorting {}
8080

8181
impl EnforceSorting {
82-
#[allow(missing_docs)]
82+
#[expect(missing_docs)]
8383
pub fn new() -> Self {
8484
Self {}
8585
}

datafusion/physical-optimizer/src/filter_pushdown.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ impl PhysicalOptimizerRule for FilterPushdown {
429429
)
430430
}
431431

432-
#[allow(deprecated)]
433432
fn optimize(
434433
&self,
435434
plan: Arc<dyn ExecutionPlan>,

datafusion/physical-optimizer/src/join_selection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use std::sync::Arc;
4747
pub struct JoinSelection {}
4848

4949
impl JoinSelection {
50-
#[allow(missing_docs)]
50+
#[expect(missing_docs)]
5151
pub fn new() -> Self {
5252
Self {}
5353
}

datafusion/physical-optimizer/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
// https://github.com/apache/datafusion/issues/11143
2525
#![deny(clippy::clone_on_ref_ptr)]
2626
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
27+
// https://github.com/apache/datafusion/issues/18881
28+
#![deny(clippy::allow_attributes)]
2729

2830
pub mod aggregate_statistics;
2931
pub mod coalesce_batches;

0 commit comments

Comments
 (0)