Skip to content

Commit 7900cd6

Browse files
chore: enforce clippy::allow_attributes for proto, pruning, session (#19350)
## 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 We want to use `#[expect]` in place of `#[allow]` on the workspace level but to get there we wanted to do this in few crates at a time before enabling it in workspace. <!-- 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. --> ## What changes are included in this PR? Attributes changes for the following crates: - datafusion-proto - datafusion-pruning - datafusion-session <!-- 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. --> ## Are these changes tested? Yes <!-- 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)? --> ## 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. --> --------- Co-authored-by: Jeffrey Vo <[email protected]>
1 parent 401345b commit 7900cd6

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

datafusion/proto/src/generated/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
#![allow(clippy::allow_attributes)]
19+
1820
#[allow(clippy::all)]
1921
#[rustfmt::skip]
2022
pub mod datafusion {

datafusion/proto/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// Make sure fast / cheap clones on Arc are explicit:
2424
// https://github.com/apache/datafusion/issues/11143
2525
#![deny(clippy::clone_on_ref_ptr)]
26+
#![deny(clippy::allow_attributes)]
2627
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
2728

2829
//! Serialize / Deserialize DataFusion Plans to bytes

datafusion/proto/src/logical_plan/file_formats.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ mod parquet {
364364
};
365365

366366
let column_specific_options = global_options.column_specific_options;
367-
#[allow(deprecated)] // max_statistics_size
368-
TableParquetOptionsProto {
367+
TableParquetOptionsProto {
369368
global: Some(ParquetOptionsProto {
370369
enable_page_index: global_options.global.enable_page_index,
371370
pruning: global_options.global.pruning,
@@ -462,8 +461,7 @@ mod parquet {
462461

463462
impl From<&ParquetOptionsProto> for ParquetOptions {
464463
fn from(proto: &ParquetOptionsProto) -> Self {
465-
#[allow(deprecated)] // max_statistics_size
466-
ParquetOptions {
464+
ParquetOptions {
467465
enable_page_index: proto.enable_page_index,
468466
pruning: proto.pruning,
469467
skip_metadata: proto.skip_metadata,
@@ -524,8 +522,7 @@ mod parquet {
524522

525523
impl From<ParquetColumnOptionsProto> for ParquetColumnOptions {
526524
fn from(proto: ParquetColumnOptionsProto) -> Self {
527-
#[allow(deprecated)] // max_statistics_size
528-
ParquetColumnOptions {
525+
ParquetColumnOptions {
529526
bloom_filter_enabled: proto.bloom_filter_enabled_opt.map(
530527
|parquet_column_options::BloomFilterEnabledOpt::BloomFilterEnabled(v)| v,
531528
),

datafusion/proto/src/logical_plan/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,17 @@ impl AsLogicalPlan for LogicalPlanNode {
422422
}
423423
Arc::new(json)
424424
}
425-
#[cfg_attr(not(feature = "avro"), allow(unused_variables))]
426425
FileFormatType::Avro(..) => {
427426
#[cfg(feature = "avro")]
428427
{
429428
Arc::new(AvroFormat)
430429
}
431430
#[cfg(not(feature = "avro"))]
432-
panic!("Unable to process avro file since `avro` feature is not enabled");
431+
{
432+
panic!(
433+
"Unable to process avro file since `avro` feature is not enabled"
434+
);
435+
}
433436
}
434437
FileFormatType::Arrow(..) => {
435438
Arc::new(ArrowFormat)

datafusion/proto/src/physical_plan/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,9 @@ impl AsExecutionPlan for protobuf::PhysicalPlanNode {
155155
PhysicalPlanType::JsonScan(scan) => {
156156
self.try_into_json_scan_physical_plan(scan, ctx, extension_codec)
157157
}
158-
#[cfg_attr(not(feature = "parquet"), allow(unused_variables))]
159158
PhysicalPlanType::ParquetScan(scan) => {
160159
self.try_into_parquet_scan_physical_plan(scan, ctx, extension_codec)
161160
}
162-
#[cfg_attr(not(feature = "avro"), allow(unused_variables))]
163161
PhysicalPlanType::AvroScan(scan) => {
164162
self.try_into_avro_scan_physical_plan(scan, ctx, extension_codec)
165163
}
@@ -672,7 +670,7 @@ impl protobuf::PhysicalPlanNode {
672670
Ok(DataSourceExec::from_data_source(scan_conf))
673671
}
674672

675-
#[cfg_attr(not(feature = "parquet"), allow(unused_variables))]
673+
#[cfg_attr(not(feature = "parquet"), expect(unused_variables))]
676674
fn try_into_parquet_scan_physical_plan(
677675
&self,
678676
scan: &protobuf::ParquetScanExecNode,
@@ -740,7 +738,7 @@ impl protobuf::PhysicalPlanNode {
740738
)
741739
}
742740

743-
#[cfg_attr(not(feature = "avro"), allow(unused_variables))]
741+
#[cfg_attr(not(feature = "avro"), expect(unused_variables))]
744742
fn try_into_avro_scan_physical_plan(
745743
&self,
746744
scan: &protobuf::AvroScanExecNode,
@@ -759,6 +757,7 @@ impl protobuf::PhysicalPlanNode {
759757
)?;
760758
Ok(DataSourceExec::from_data_source(conf))
761759
}
760+
762761
#[cfg(not(feature = "avro"))]
763762
panic!("Unable to process a Avro PhysicalPlan when `avro` feature is not enabled")
764763
}

datafusion/pruning/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717

1818
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
19+
#![deny(clippy::allow_attributes)]
1920

2021
mod file_pruner;
2122
mod pruning_predicate;

datafusion/pruning/src/pruning_predicate.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,6 @@ impl PruningPredicate {
604604
is_always_true(&self.predicate_expr) && self.literal_guarantees.is_empty()
605605
}
606606

607-
// this is only used by `parquet` feature right now
608-
#[allow(dead_code)]
609607
pub fn required_columns(&self) -> &RequiredColumns {
610608
&self.required_columns
611609
}
@@ -744,8 +742,6 @@ impl RequiredColumns {
744742
/// * `a > 5 OR a < 10` returns `Some(a)`
745743
/// * `a > 5 OR b < 10` returns `None`
746744
/// * `true` returns None
747-
#[allow(dead_code)]
748-
// this fn is only used by `parquet` feature right now, thus the `allow(dead_code)`
749745
pub fn single_column(&self) -> Option<&phys_expr::Column> {
750746
if self.columns.windows(2).all(|w| {
751747
// check if all columns are the same (ignoring statistics and field)

datafusion/session/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717

1818
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
19+
#![deny(clippy::allow_attributes)]
1920

2021
//! Session management for DataFusion query execution environment
2122
//!

0 commit comments

Comments
 (0)