Skip to content

Commit 71fdad0

Browse files
chakkk309Jefffrey
andauthored
chore: enforce clippy::allow_attributes for datasource crates (#19068)
## Which issue does this PR close? Part of #18881 ## Rationale for this change Implement clippy::allow_attributes lint for datasource* crates ## What changes are included in this PR? 1. Added lint enforcement: `#![deny(clippy::allow_attributes)]` to 6 datasource module mod.rs files 2. Attribute conversion: Changed 3 `#[allow(...)]` to `#[expect(...)]`: - deprecated - unused_imports - rustdoc::broken_intra_doc_links ## Are these changes tested? yes ## Are there any user-facing changes? No user-facing changes. --------- Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
1 parent 00e7952 commit 71fdad0

File tree

13 files changed

+18
-17
lines changed

13 files changed

+18
-17
lines changed

datafusion/datasource-arrow/src/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// Make sure fast / cheap clones on Arc are explicit:
2020
// https://github.com/apache/datafusion/issues/11143
2121
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
22+
#![deny(clippy::allow_attributes)]
2223

2324
//! [`ArrowFormat`]: Apache Arrow file format abstractions
2425

datafusion/datasource-avro/src/mod.rs

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

2829
//! An [Avro](https://avro.apache.org/) based [`FileSource`](datafusion_datasource::file::FileSource) implementation and related functionality.
2930

datafusion/datasource-csv/src/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// Make sure fast / cheap clones on Arc are explicit:
2020
// https://github.com/apache/datafusion/issues/11143
2121
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
22+
#![deny(clippy::allow_attributes)]
2223

2324
pub mod file_format;
2425
pub mod source;

datafusion/datasource-json/src/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// Make sure fast / cheap clones on Arc are explicit:
2020
// https://github.com/apache/datafusion/issues/11143
2121
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
22+
#![deny(clippy::allow_attributes)]
2223

2324
pub mod file_format;
2425
pub mod source;

datafusion/datasource-parquet/src/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// https://github.com/apache/datafusion/issues/11143
2020
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
2121
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
22+
#![deny(clippy::allow_attributes)]
2223

2324
pub mod access_plan;
2425
pub mod file_format;

datafusion/datasource-parquet/src/opener.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,6 @@ where
584584
}
585585

586586
#[derive(Default)]
587-
#[cfg_attr(not(feature = "parquet_encryption"), allow(dead_code))]
588587
struct EncryptionContext {
589588
#[cfg(feature = "parquet_encryption")]
590589
file_decryption_properties: Option<Arc<FileDecryptionProperties>>,
@@ -626,7 +625,7 @@ impl EncryptionContext {
626625
}
627626

628627
#[cfg(not(feature = "parquet_encryption"))]
629-
#[allow(dead_code)]
628+
#[expect(dead_code)]
630629
impl EncryptionContext {
631630
async fn get_file_decryption_properties(
632631
&self,
@@ -646,7 +645,7 @@ impl ParquetOpener {
646645
}
647646

648647
#[cfg(not(feature = "parquet_encryption"))]
649-
#[allow(dead_code)]
648+
#[expect(dead_code)]
650649
fn get_encryption_context(&self) -> EncryptionContext {
651650
EncryptionContext::default()
652651
}

datafusion/datasource-parquet/src/reader.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ impl AsyncFileReader for CachedParquetFileReader {
289289

290290
fn get_metadata<'a>(
291291
&'a mut self,
292-
#[allow(unused_variables)] options: Option<&'a ArrowReaderOptions>,
292+
#[cfg_attr(not(feature = "parquet_encryption"), expect(unused_variables))]
293+
options: Option<&'a ArrowReaderOptions>,
293294
) -> BoxFuture<'a, parquet::errors::Result<Arc<ParquetMetaData>>> {
294295
let object_meta = self.partitioned_file.object_meta.clone();
295296
let metadata_cache = Arc::clone(&self.metadata_cache);

datafusion/datasource-parquet/src/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ mod tests {
803803
use datafusion_physical_expr::expressions::lit;
804804

805805
#[test]
806-
#[allow(deprecated)]
806+
#[expect(deprecated)]
807807
fn test_parquet_source_predicate_same_as_filter() {
808808
let predicate = lit(true);
809809

datafusion/datasource/src/file_scan_config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
//! file sources.
2020
2121
use crate::file_groups::FileGroup;
22-
#[allow(unused_imports)]
23-
use crate::schema_adapter::SchemaAdapterFactory;
2422
use crate::{
2523
display::FileGroupsDisplay, file::FileSource,
2624
file_compression_type::FileCompressionType, file_stream::FileStream,

datafusion/datasource/src/file_stream.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ impl StartableTime {
354354
}
355355
}
356356

357-
#[allow(rustdoc::broken_intra_doc_links)]
358357
/// Metrics for [`FileStream`]
359358
///
360359
/// Note that all of these metrics are in terms of wall clock time

0 commit comments

Comments
 (0)