Skip to content

Apache DataFusion SQL Query Engine

Enforce `clippy::allow_attributes` globally across workspace (#19576)

Jeffrey Vo5f9bacddcd14
diff --git a/Cargo.toml b/Cargo.toml
index bc592ecbd6..03c3f8d4b3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -201,6 +201,8 @@ uninlined_format_args = "warn"
inefficient_to_string = "warn"
# https://github.com/apache/datafusion/issues/18503
needless_pass_by_value = "warn"
+# https://github.com/apache/datafusion/issues/18881
+allow_attributes = "warn"
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
diff --git a/datafusion-examples/examples/custom_data_source/adapter_serialization.rs b/datafusion-examples/examples/custom_data_source/adapter_serialization.rs
index 4f76d105a5..f19d628fa8 100644
--- a/datafusion-examples/examples/custom_data_source/adapter_serialization.rs
+++ b/datafusion-examples/examples/custom_data_source/adapter_serialization.rs
@@ -219,7 +219,7 @@ struct MetadataAdapterFactory {
// Rust's dead code analysis doesn't recognize Debug-based field access.
// In PR #19234, this field is used by `with_partition_values`, but that method
// doesn't exist in upstream DataFusion's PhysicalExprAdapter trait.
- #[allow(dead_code)]
+ #[expect(dead_code)]
tag: String,
}
diff --git a/datafusion-examples/examples/custom_data_source/file_stream_provider.rs b/datafusion-examples/examples/custom_data_source/file_stream_provider.rs
index 936da0a33d..5b43072d43 100644
--- a/datafusion-examples/examples/custom_data_source/file_stream_provider.rs
+++ b/datafusion-examples/examples/custom_data_source/file_stream_provider.rs
@@ -22,7 +22,7 @@
///
/// On non-Windows systems, this example creates a named pipe (FIFO) and
/// writes rows into it asynchronously while DataFusion reads the data
-/// through a `FileStreamProvider`.
+/// through a `FileStreamProvider`.
///
/// This illustrates how to integrate dynamically updated data sources
/// with DataFusion without needing to reload the entire dataset each time.
@@ -126,7 +126,6 @@ mod non_windows {
let broken_pipe_timeout = Duration::from_secs(10);
let sa = file_path;
// Spawn a new thread to write to the FIFO file
- #[allow(clippy::disallowed_methods)] // spawn allowed only in tests
tasks.spawn_blocking(move || {
let file = OpenOptions::new().write(true).open(sa).unwrap();
// Reference time to use when deciding to fail the test
diff --git a/datafusion-examples/examples/data_io/catalog.rs b/datafusion-examples/examples/data_io/catalog.rs
index d2ddff82e3..9781a93374 100644
--- a/datafusion-examples/examples/data_io/catalog.rs
+++ b/datafusion-examples/examples/data_io/catalog.rs
@@ -140,7 +140,6 @@ struct DirSchemaOpts<'a> {
/// Schema where every file with extension `ext` in a given `dir` is a table.
#[derive(Debug)]
struct DirSchema {
- ext: String,
tables: RwLock<HashMap<String, Arc<dyn TableProvider>>>,
}
@@ -173,14 +172,8 @@ impl DirSchema {
}
Ok(Arc::new(Self {
tables: RwLock::new(tables),
- ext: ext.to_string(),
}))
}
-
- #[allow(unused)]
- fn name(&self) -> &str {
- &self.ext
- }
}
#[async_trait]
@@ -217,7 +210,6 @@ impl SchemaProvider for DirSchema {
/// If supported by the implementation, removes an existing table from this schema and returns it.
/// If no table of that name exists, returns Ok(None).
- #[allow(unused_variables)]
fn deregister_table(&self, name: &str) -> Result<Option<Arc<dyn TableProvider>>> {
let mut tables = self.tables.write().unwrap();
log::info!("dropping table {name}");
diff --git a/datafusion-examples/examples/flight/sql_server.rs b/datafusion-examples/examples/flight/sql_server.rs
index 78b3aaa05a..e55aaa7250 100644
--- a/datafusion-examples/examples/flight/sql_server.rs
+++ b/datafusion-examples/examples/flight/sql_server.rs
@@ -120,7 +120,6 @@ impl FlightSqlServiceImpl {
Ok(uuid)
}
- #[allow(clippy::result_large_err)]
fn get_ctx<T>(&self, req: &Request<T>) -> Result<Arc<SessionContext>, Status> {
// get the token from the authorization header on Request
let auth = req
@@ -146,7 +145,6 @@ impl FlightSqlServiceImpl {
}
}
- #[allow(clippy::result_large_err)]
fn get_plan(&self, handle: &str) -> Result<LogicalPlan, Status> {
if let Some(plan) = self.statements.get(handle) {
Ok(plan.clone())
@@ -155,7 +153,6 @@ impl FlightSqlServiceImpl {
}
}
- #[allow(clippy::result_large_err)]
fn get_result(&self, handle: &str) -> Result<Vec<RecordBatch>, Status> {
if let Some(result) = self.results.get(handle) {
Ok(result.clone())
@@ -203,13 +200,11 @@ impl FlightSqlServiceImpl {
.unwrap()
}
- #[allow(clippy::result_large_err)]
fn remove_plan(&self, handle: &str) -> Result<(), Status> {
self.statements.remove(&handle.to_string());
Ok(())
}
- #[allow(clippy::result_large_err)]
fn remove_result(&self, handle: &str) -> Result<(), Status> {
self.results.remove(&handle.to_string());
Ok(())
diff --git a/datafusion/catalog-listing/src/mod.rs b/datafusion/catalog-listing/src/mod.rs
index 28bd880ea0..9efb5aa962 100644
--- a/datafusion/catalog-listing/src/mod.rs
+++ b/datafusion/catalog-listing/src/mod.rs
@@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg",
diff --git a/datafusion/catalog/src/lib.rs b/datafusion/catalog/src/lib.rs
index d1cd3998fe..931941e8fd 100644
--- a/datafusion/catalog/src/lib.rs
+++ b/datafusion/catalog/src/lib.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
//! Interfaces and default implementations of catalogs and schemas.
//!
diff --git a/datafusion/common-runtime/src/lib.rs b/datafusion/common-runtime/src/lib.rs
index fdbfe7f239..cf45ccf3ef 100644
--- a/datafusion/common-runtime/src/lib.rs
+++ b/datafusion/common-runtime/src/lib.rs
@@ -16,7 +16,6 @@
// under the License.
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg",
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
diff --git a/datafusion/common/src/lib.rs b/datafusion/common/src/lib.rs
index df6659c6f8..fdd04f7524 100644
--- a/datafusion/common/src/lib.rs
+++ b/datafusion/common/src/lib.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
mod column;
mod dfschema;
diff --git a/datafusion/core/benches/data_utils/mod.rs b/datafusion/core/benches/data_utils/mod.rs
index 630bc05660..accd51ae58 100644
--- a/datafusion/core/benches/data_utils/mod.rs
+++ b/datafusion/core/benches/data_utils/mod.rs
@@ -36,6 +36,7 @@ use std::sync::Arc;
/// create an in-memory table given the partition len, array len, and batch size,
/// and the result table will be of array_len in total, and then partitioned, and batched.
+#[expect(clippy::allow_attributes)] // some issue where expect(dead_code) doesn't fire properly
#[allow(dead_code)]
pub fn create_table_provider(
partitions_len: usize,
@@ -183,6 +184,7 @@ impl TraceIdBuilder {
/// Create time series data with `partition_cnt` partitions and `sample_cnt` rows per partition
/// in ascending order, if `asc` is true, otherwise randomly sampled using a Pareto distribution
+#[expect(clippy::allow_attributes)] // some issue where expect(dead_code) doesn't fire properly
#[allow(dead_code)]
pub(crate) fn make_data(
partition_cnt: i32,
diff --git a/datafusion/core/benches/preserve_file_partitioning.rs b/datafusion/core/benches/preserve_file_partitioning.rs
index 17ebca52cd..9b1f59adc6 100644
--- a/datafusion/core/benches/preserve_file_partitioning.rs
+++ b/datafusion/core/benches/preserve_file_partitioning.rs
@@ -322,7 +322,7 @@ async fn save_plans(
}
}
-#[allow(clippy::too_many_arguments)]
+#[expect(clippy::too_many_arguments)]
fn run_benchmark(
c: &mut Criterion,
rt: &Runtime,
diff --git a/datafusion/core/src/bin/print_functions_docs.rs b/datafusion/core/src/bin/print_functions_docs.rs
index 74a10bf079..2466d42692 100644
--- a/datafusion/core/src/bin/print_functions_docs.rs
+++ b/datafusion/core/src/bin/print_functions_docs.rs
@@ -84,30 +84,6 @@ fn print_window_docs() -> Result<String> {
print_docs(providers, window_doc_sections::doc_sections())
}
-// Temporary method useful to semi automate
-// the migration of UDF documentation generation from code based
-// to attribute based
-// To be removed
-#[allow(dead_code)]
-fn save_doc_code_text(documentation: &Documentation, name: &str) {
- let attr_text = documentation.to_doc_attribute();
-
- let file_path = format!("{name}.txt");
- if std::path::Path::new(&file_path).exists() {
- std::fs::remove_file(&file_path).unwrap();
- }
-
- // Open the file in append mode, create it if it doesn't exist
- let mut file = std::fs::OpenOptions::new()
- .append(true) // Open in append mode
- .create(true) // Create the file if it doesn't exist
- .open(file_path)
- .unwrap();
-
- use std::io::Write;
- file.write_all(attr_text.as_bytes()).unwrap();
-}
-
#[expect(clippy::needless_pass_by_value)]
fn print_docs(
providers: Vec<Box<dyn DocProvider>>,
@@ -306,8 +282,7 @@ impl DocProvider for WindowUDF {
}
}
-#[allow(clippy::borrowed_box)]
-#[allow(clippy::ptr_arg)]
+#[expect(clippy::borrowed_box)]
fn get_names_and_aliases(functions: &Vec<&Box<dyn DocProvider>>) -> Vec<String> {
functions
.iter()
diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rs
index e83934a8e2..3815d650ae 100644
--- a/datafusion/core/src/lib.rs
+++ b/datafusion/core/src/lib.rs
@@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-#![deny(clippy::allow_attributes)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg",
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
diff --git a/datafusion/core/tests/custom_sources_cases/dml_planning.rs b/datafusion/core/tests/custom_sources_cases/dml_planning.rs
index a4033e445c..c53819ffcc 100644
--- a/datafusion/core/tests/custom_sources_cases/dml_planning.rs
+++ b/datafusion/core/tests/custom_sources_cases/dml_planning.rs
@@ -95,7 +95,7 @@ impl TableProvider for CaptureDeleteProvider {
}
/// A TableProvider that captures filters and assignments passed to update().
-#[allow(clippy::type_complexity)]
+#[expect(clippy::type_complexity)]
struct CaptureUpdateProvider {
schema: SchemaRef,
received_filters: Arc<Mutex<Option<Vec<Expr>>>>,
diff --git a/datafusion/core/tests/execution/coop.rs b/datafusion/core/tests/execution/coop.rs
index 528703ba78..9818d9d98f 100644
--- a/datafusion/core/tests/execution/coop.rs
+++ b/datafusion/core/tests/execution/coop.rs
@@ -767,7 +767,7 @@ async fn hash_join_without_repartition_and_no_agg(
#[derive(Debug)]
enum Yielded {
ReadyOrPending,
- Err(#[allow(dead_code)] DataFusionError),
+ Err(#[expect(dead_code)] DataFusionError),
Timeout,
}
diff --git a/datafusion/core/tests/fifo/mod.rs b/datafusion/core/tests/fifo/mod.rs
index 36cc769417..3d99cc72fa 100644
--- a/datafusion/core/tests/fifo/mod.rs
+++ b/datafusion/core/tests/fifo/mod.rs
@@ -94,7 +94,6 @@ mod unix_test {
/// This function creates a writing task for the FIFO file. To verify
/// incremental processing, it waits for a signal to continue writing after
/// a certain number of lines are written.
- #[allow(clippy::disallowed_methods)]
fn create_writing_task(
file_path: PathBuf,
header: String,
@@ -105,6 +104,7 @@ mod unix_test {
// Timeout for a long period of BrokenPipe error
let broken_pipe_timeout = Duration::from_secs(10);
// Spawn a new task to write to the FIFO file
+ #[expect(clippy::disallowed_methods)]
tokio::spawn(async move {
let mut file = tokio::fs::OpenOptions::new()
.write(true)
@@ -357,7 +357,7 @@ mod unix_test {
(sink_fifo_path.clone(), sink_fifo_path.display());
// Spawn a new thread to read sink EXTERNAL TABLE.
- #[allow(clippy::disallowed_methods)] // spawn allowed only in tests
+ #[expect(clippy::disallowed_methods)] // spawn allowed only in tests
tasks.push(spawn_blocking(move || {
let file = File::open(sink_fifo_path_thread).unwrap();
let schema = Arc::new(Schema::new(vec![
diff --git a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/context_generator.rs b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/context_generator.rs
index bf71053d6c..fe31098622 100644
--- a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/context_generator.rs
+++ b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/context_generator.rs
@@ -214,7 +214,7 @@ impl GeneratedSessionContextBuilder {
/// The generated params for [`SessionContext`]
#[derive(Debug)]
-#[allow(dead_code)]
+#[expect(dead_code)]
pub struct SessionContextParams {
batch_size: usize,
target_partitions: usize,
diff --git a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs
index 0d04e98536..7bb6177c31 100644
--- a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs
+++ b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs
@@ -182,13 +182,13 @@ impl QueryBuilder {
/// Add max columns num in group by(default: 3), for example if it is set to 1,
/// the generated sql will group by at most 1 column
- #[allow(dead_code)]
+ #[expect(dead_code)]
pub fn with_max_group_by_columns(mut self, max_group_by_columns: usize) -> Self {
self.max_group_by_columns = max_group_by_columns;
self
}
- #[allow(dead_code)]
+ #[expect(dead_code)]
pub fn with_min_group_by_columns(mut self, min_group_by_columns: usize) -> Self {
self.min_group_by_columns = min_group_by_columns;
self
@@ -202,7 +202,7 @@ impl QueryBuilder {
}
/// Add if also test the no grouping aggregation case(default: true)
- #[allow(dead_code)]
+ #[expect(dead_code)]
pub fn with_no_grouping(mut self, no_grouping: bool) -> Self {
self.no_grouping = no_grouping;
self
diff --git a/datafusion/core/tests/fuzz_cases/join_fuzz.rs b/datafusion/core/tests/fuzz_cases/join_fuzz.rs
index 111a232020..669b98e39f 100644
--- a/datafusion/core/tests/fuzz_cases/join_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/join_fuzz.rs
@@ -1087,7 +1087,7 @@ impl JoinFuzzTestCase {
/// Files can be of different sizes
/// The method can be useful to read partitions have been saved by `save_partitioned_batches_as_parquet`
/// for test debugging purposes
- #[allow(dead_code)]
+ #[expect(dead_code)]
async fn load_partitioned_batches_from_parquet(
dir: &str,
) -> std::io::Result<Vec<RecordBatch>> {
diff --git a/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs b/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs
index c424a31427..8f3b8ea053 100644
--- a/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs
@@ -301,7 +301,7 @@ mod sp_repartition_fuzz_tests {
let mut handles = Vec::new();
for seed in seed_start..seed_end {
- #[allow(clippy::disallowed_methods)] // spawn allowed only in tests
+ #[expect(clippy::disallowed_methods)] // spawn allowed only in tests
let job = tokio::spawn(run_sort_preserving_repartition_test(
make_staggered_batches::<true>(n_row, n_distinct, seed as u64),
is_first_roundrobin,
diff --git a/datafusion/core/tests/macro_hygiene/mod.rs b/datafusion/core/tests/macro_hygiene/mod.rs
index 48f0103113..9fd60cd1f0 100644
--- a/datafusion/core/tests/macro_hygiene/mod.rs
+++ b/datafusion/core/tests/macro_hygiene/mod.rs
@@ -73,7 +73,7 @@ mod config_field {
#[test]
fn test_macro() {
#[derive(Debug)]
- #[allow(dead_code)]
+ #[expect(dead_code)]
struct E;
impl std::fmt::Display for E {
@@ -84,7 +84,7 @@ mod config_field {
impl std::error::Error for E {}
- #[allow(dead_code)]
+ #[expect(dead_code)]
#[derive(Default)]
struct S;
diff --git a/datafusion/core/tests/parquet/filter_pushdown.rs b/datafusion/core/tests/parquet/filter_pushdown.rs
index f84f91f879..1eb8103d3e 100644
--- a/datafusion/core/tests/parquet/filter_pushdown.rs
+++ b/datafusion/core/tests/parquet/filter_pushdown.rs
@@ -220,7 +220,6 @@ async fn single_file() {
}
#[tokio::test]
-#[allow(dead_code)]
async fn single_file_small_data_pages() {
let batches = read_parquet_test_data(
"tests/data/filter_pushdown/single_file_small_pages.gz.parquet",
diff --git a/datafusion/datasource-arrow/src/mod.rs b/datafusion/datasource-arrow/src/mod.rs
index cbfd788709..4816a45942 100644
--- a/datafusion/datasource-arrow/src/mod.rs
+++ b/datafusion/datasource-arrow/src/mod.rs
@@ -19,7 +19,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
-#![deny(clippy::allow_attributes)]
//! [`ArrowFormat`]: Apache Arrow file format abstractions
diff --git a/datafusion/datasource-avro/src/mod.rs b/datafusion/datasource-avro/src/mod.rs
index 22c40e203a..5ad209591e 100644
--- a/datafusion/datasource-avro/src/mod.rs
+++ b/datafusion/datasource-avro/src/mod.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
//! An [Avro](https://avro.apache.org/) based [`FileSource`](datafusion_datasource::file::FileSource) implementation and related functionality.
diff --git a/datafusion/datasource-csv/src/mod.rs b/datafusion/datasource-csv/src/mod.rs
index d58ce11885..fdfee05d86 100644
--- a/datafusion/datasource-csv/src/mod.rs
+++ b/datafusion/datasource-csv/src/mod.rs
@@ -19,7 +19,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
-#![deny(clippy::allow_attributes)]
pub mod file_format;
pub mod source;
diff --git a/datafusion/datasource-json/src/mod.rs b/datafusion/datasource-json/src/mod.rs
index 3d27d4cc5e..c39ee2cd93 100644
--- a/datafusion/datasource-json/src/mod.rs
+++ b/datafusion/datasource-json/src/mod.rs
@@ -19,7 +19,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
-#![deny(clippy::allow_attributes)]
pub mod file_format;
pub mod source;
diff --git a/datafusion/datasource-parquet/src/mod.rs b/datafusion/datasource-parquet/src/mod.rs
index d7e92f70af..0e137a706f 100644
--- a/datafusion/datasource-parquet/src/mod.rs
+++ b/datafusion/datasource-parquet/src/mod.rs
@@ -19,7 +19,6 @@
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
pub mod access_plan;
pub mod file_format;
diff --git a/datafusion/datasource/src/mod.rs b/datafusion/datasource/src/mod.rs
index 2965be7637..f80c9cb0b0 100644
--- a/datafusion/datasource/src/mod.rs
+++ b/datafusion/datasource/src/mod.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
//! A table that uses the `ObjectStore` listing capability
//! to get the list of files to process.
diff --git a/datafusion/doc/src/lib.rs b/datafusion/doc/src/lib.rs
index 836cb9345b..591a5a62f3 100644
--- a/datafusion/doc/src/lib.rs
+++ b/datafusion/doc/src/lib.rs
@@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg",
diff --git a/datafusion/execution/src/lib.rs b/datafusion/execution/src/lib.rs
index aced2f46d7..1a8da9459a 100644
--- a/datafusion/execution/src/lib.rs
+++ b/datafusion/execution/src/lib.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
//! DataFusion execution configuration and runtime structures
diff --git a/datafusion/expr-common/src/lib.rs b/datafusion/expr-common/src/lib.rs
index 2be066beaa..0018694d18 100644
--- a/datafusion/expr-common/src/lib.rs
+++ b/datafusion/expr-common/src/lib.rs
@@ -32,7 +32,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
pub mod accumulator;
pub mod casts;
diff --git a/datafusion/expr/src/lib.rs b/datafusion/expr/src/lib.rs
index 978e9f6275..201f7a0251 100644
--- a/datafusion/expr/src/lib.rs
+++ b/datafusion/expr/src/lib.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
//! [DataFusion](https://github.com/apache/datafusion)
//! is an extensible query execution framework that uses
diff --git a/datafusion/ffi/src/lib.rs b/datafusion/ffi/src/lib.rs
index bf0cf9b122..2ca9b8f6f4 100644
--- a/datafusion/ffi/src/lib.rs
+++ b/datafusion/ffi/src/lib.rs
@@ -24,7 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
pub mod arrow_wrappers;
pub mod catalog_provider;
diff --git a/datafusion/functions-aggregate-common/src/lib.rs b/datafusion/functions-aggregate-common/src/lib.rs
index 61b8800950..574d160d42 100644
--- a/datafusion/functions-aggregate-common/src/lib.rs
+++ b/datafusion/functions-aggregate-common/src/lib.rs
@@ -31,8 +31,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
pub mod accumulator;
pub mod aggregate;
diff --git a/datafusion/functions-aggregate/benches/array_agg.rs b/datafusion/functions-aggregate/benches/array_agg.rs
index d7f6873863..793c2aac96 100644
--- a/datafusion/functions-aggregate/benches/array_agg.rs
+++ b/datafusion/functions-aggregate/benches/array_agg.rs
@@ -43,7 +43,7 @@ fn merge_batch_bench(c: &mut Criterion, name: &str, values: ArrayRef) {
let list_item_data_type = values.as_list::<i32>().values().data_type().clone();
c.bench_function(name, |b| {
b.iter(|| {
- #[allow(clippy::unit_arg)]
+ #[expect(clippy::unit_arg)]
black_box(
ArrayAggAccumulator::try_new(&list_item_data_type, false)
.unwrap()
diff --git a/datafusion/functions-aggregate/benches/count.rs b/datafusion/functions-aggregate/benches/count.rs
index 711bbe5a3c..48f71858c1 100644
--- a/datafusion/functions-aggregate/benches/count.rs
+++ b/datafusion/functions-aggregate/benches/count.rs
@@ -130,7 +130,7 @@ fn count_benchmark(c: &mut Criterion) {
let mut accumulator = prepare_accumulator();
c.bench_function("count low cardinality dict 20% nulls, no filter", |b| {
b.iter(|| {
- #[allow(clippy::unit_arg)]
+ #[expect(clippy::unit_arg)]
black_box(
accumulator
.update_batch(std::slice::from_ref(&values))
diff --git a/datafusion/functions-aggregate/src/lib.rs b/datafusion/functions-aggregate/src/lib.rs
index f364b785dd..1b9996220d 100644
--- a/datafusion/functions-aggregate/src/lib.rs
+++ b/datafusion/functions-aggregate/src/lib.rs
@@ -24,8 +24,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Aggregate Function packages for [DataFusion].
//!
diff --git a/datafusion/functions-nested/src/lib.rs b/datafusion/functions-nested/src/lib.rs
index ed9e1af4ea..9ac6911236 100644
--- a/datafusion/functions-nested/src/lib.rs
+++ b/datafusion/functions-nested/src/lib.rs
@@ -24,8 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Nested type Functions for [DataFusion].
//!
diff --git a/datafusion/functions-table/src/lib.rs b/datafusion/functions-table/src/lib.rs
index 1783c15b14..cd9ade041a 100644
--- a/datafusion/functions-table/src/lib.rs
+++ b/datafusion/functions-table/src/lib.rs
@@ -24,8 +24,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
pub mod generate_series;
diff --git a/datafusion/functions-window-common/src/lib.rs b/datafusion/functions-window-common/src/lib.rs
index 210e54d672..301f2c34a6 100644
--- a/datafusion/functions-window-common/src/lib.rs
+++ b/datafusion/functions-window-common/src/lib.rs
@@ -24,8 +24,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Common user-defined window functionality for [DataFusion]
//!
diff --git a/datafusion/functions-window/src/lib.rs b/datafusion/functions-window/src/lib.rs
index 3003133873..6edfb92744 100644
--- a/datafusion/functions-window/src/lib.rs
+++ b/datafusion/functions-window/src/lib.rs
@@ -25,7 +25,6 @@
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Window Function packages for [DataFusion].
//!
diff --git a/datafusion/functions/benches/trim.rs b/datafusion/functions/benches/trim.rs
index 29bbc3f7dc..ad2b10e201 100644
--- a/datafusion/functions/benches/trim.rs
+++ b/datafusion/functions/benches/trim.rs
@@ -143,7 +143,7 @@ fn create_args(
]
}
-#[allow(clippy::too_many_arguments)]
+#[expect(clippy::too_many_arguments)]
fn run_with_string_type<M: Measurement>(
group: &mut BenchmarkGroup<'_, M>,
trim_func: &ScalarUDF,
@@ -189,7 +189,7 @@ fn run_with_string_type<M: Measurement>(
);
}
-#[allow(clippy::too_many_arguments)]
+#[expect(clippy::too_many_arguments)]
fn run_trim_benchmark(
c: &mut Criterion,
group_name: &str,
diff --git a/datafusion/functions/src/lib.rs b/datafusion/functions/src/lib.rs
index f88304a6a5..b9ce113efa 100644
--- a/datafusion/functions/src/lib.rs
+++ b/datafusion/functions/src/lib.rs
@@ -24,8 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Function packages for [DataFusion].
//!
diff --git a/datafusion/macros/src/user_doc.rs b/datafusion/macros/src/user_doc.rs
index 27f73fd955..ce9e7d55ef 100644
--- a/datafusion/macros/src/user_doc.rs
+++ b/datafusion/macros/src/user_doc.rs
@@ -20,7 +20,6 @@
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
-#![deny(clippy::allow_attributes)]
extern crate proc_macro;
use datafusion_doc::scalar_doc_sections::doc_sections_const;
diff --git a/datafusion/optimizer/src/lib.rs b/datafusion/optimizer/src/lib.rs
index f8ab453591..e6b24dec87 100644
--- a/datafusion/optimizer/src/lib.rs
+++ b/datafusion/optimizer/src/lib.rs
@@ -23,7 +23,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
//! # DataFusion Optimizer
diff --git a/datafusion/physical-expr-adapter/src/lib.rs b/datafusion/physical-expr-adapter/src/lib.rs
index 5ae86f219b..ea4db19ee1 100644
--- a/datafusion/physical-expr-adapter/src/lib.rs
+++ b/datafusion/physical-expr-adapter/src/lib.rs
@@ -21,8 +21,6 @@
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Physical expression schema adaptation utilities for DataFusion
diff --git a/datafusion/physical-expr-common/src/lib.rs b/datafusion/physical-expr-common/src/lib.rs
index 84378a3d26..b6eaacdca2 100644
--- a/datafusion/physical-expr-common/src/lib.rs
+++ b/datafusion/physical-expr-common/src/lib.rs
@@ -24,8 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Physical Expr Common packages for [DataFusion]
//! This package contains high level PhysicalExpr trait
diff --git a/datafusion/physical-expr/src/lib.rs b/datafusion/physical-expr/src/lib.rs
index 988e14c28e..bedd348dab 100644
--- a/datafusion/physical-expr/src/lib.rs
+++ b/datafusion/physical-expr/src/lib.rs
@@ -24,8 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
// Backward compatibility
pub mod aggregate;
diff --git a/datafusion/physical-optimizer/src/lib.rs b/datafusion/physical-optimizer/src/lib.rs
index e98772291c..3a0d79ae2d 100644
--- a/datafusion/physical-optimizer/src/lib.rs
+++ b/datafusion/physical-optimizer/src/lib.rs
@@ -24,8 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
pub mod aggregate_statistics;
pub mod combine_partial_final_agg;
diff --git a/datafusion/physical-plan/src/lib.rs b/datafusion/physical-plan/src/lib.rs
index 9352a143c1..74b3cddc04 100644
--- a/datafusion/physical-plan/src/lib.rs
+++ b/datafusion/physical-plan/src/lib.rs
@@ -24,8 +24,6 @@
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-// https://github.com/apache/datafusion/issues/18881
-#![deny(clippy::allow_attributes)]
//! Traits for physical query plan, supporting parallel execution for partitioned relations.
//!
diff --git a/datafusion/proto-common/src/generated/mod.rs b/datafusion/proto-common/src/generated/mod.rs
index 08cd75b622..9c2ca9385a 100644
--- a/datafusion/proto-common/src/generated/mod.rs
+++ b/datafusion/proto-common/src/generated/mod.rs
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+// This code is generated so we don't want to fix any lint violations manually
#[allow(clippy::allow_attributes)]
#[allow(clippy::all)]
#[rustfmt::skip]
diff --git a/datafusion/proto-common/src/lib.rs b/datafusion/proto-common/src/lib.rs
index b7e1c906d9..6f7fb7b89c 100644
--- a/datafusion/proto-common/src/lib.rs
+++ b/datafusion/proto-common/src/lib.rs
@@ -24,7 +24,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
-#![deny(clippy::allow_attributes)]
//! Serialize / Deserialize DataFusion Primitive Types to bytes
//!
diff --git a/datafusion/proto/src/generated/mod.rs b/datafusion/proto/src/generated/mod.rs
index adf5125457..ca32b1500d 100644
--- a/datafusion/proto/src/generated/mod.rs
+++ b/datafusion/proto/src/generated/mod.rs
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-#![allow(clippy::allow_attributes)]
-
+// This code is generated so we don't want to fix any lint violations manually
+#[allow(clippy::allow_attributes)]
#[allow(clippy::all)]
#[rustfmt::skip]
pub mod datafusion {
diff --git a/datafusion/proto/src/lib.rs b/datafusion/proto/src/lib.rs
index e30d2a2234..7ddc930fa2 100644
--- a/datafusion/proto/src/lib.rs
+++ b/datafusion/proto/src/lib.rs
@@ -23,7 +23,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
//! Serialize / Deserialize DataFusion Plans to bytes
diff --git a/datafusion/pruning/src/lib.rs b/datafusion/pruning/src/lib.rs
index 9f8142447b..be17f29eaa 100644
--- a/datafusion/pruning/src/lib.rs
+++ b/datafusion/pruning/src/lib.rs
@@ -16,7 +16,6 @@
// under the License.
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
mod file_pruner;
mod pruning_predicate;
diff --git a/datafusion/session/src/lib.rs b/datafusion/session/src/lib.rs
index 3d3cb541b5..11f734e757 100644
--- a/datafusion/session/src/lib.rs
+++ b/datafusion/session/src/lib.rs
@@ -16,7 +16,6 @@
// under the License.
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
-#![deny(clippy::allow_attributes)]
//! Session management for DataFusion query execution environment
//!
diff --git a/datafusion/spark/src/lib.rs b/datafusion/spark/src/lib.rs
index 30064024b4..9575f560b8 100644
--- a/datafusion/spark/src/lib.rs
+++ b/datafusion/spark/src/lib.rs
@@ -22,7 +22,6 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
// Make cheap clones clear: https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
//! Spark Expression packages for [DataFusion].
diff --git a/datafusion/sql/src/lib.rs b/datafusion/sql/src/lib.rs
index b21eb52920..7fef670933 100644
--- a/datafusion/sql/src/lib.rs
+++ b/datafusion/sql/src/lib.rs
@@ -23,7 +23,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
//! This crate provides:
diff --git a/datafusion/sqllogictest/src/util.rs b/datafusion/sqllogictest/src/util.rs
index 6a3d3944e4..b0cf32266e 100644
--- a/datafusion/sqllogictest/src/util.rs
+++ b/datafusion/sqllogictest/src/util.rs
@@ -44,7 +44,7 @@ pub fn setup_scratch_dir(name: &Path) -> Result<()> {
/// Trailing whitespace from lines in SLT will typically be removed, but do not fail if it is not
/// If particular test wants to cover trailing whitespace on a value,
/// it should project additional non-whitespace column on the right.
-#[allow(clippy::ptr_arg)]
+#[expect(clippy::ptr_arg)]
pub fn value_normalizer(s: &String) -> String {
s.trim_end().to_string()
}
diff --git a/datafusion/substrait/src/lib.rs b/datafusion/substrait/src/lib.rs
index 407408aaa7..0819fd3a59 100644
--- a/datafusion/substrait/src/lib.rs
+++ b/datafusion/substrait/src/lib.rs
@@ -23,7 +23,6 @@
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![cfg_attr(not(test), deny(clippy::clone_on_ref_ptr))]
-#![deny(clippy::allow_attributes)]
#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
//! Serialize / Deserialize DataFusion Plans to [Substrait.io]
diff --git a/datafusion/wasmtest/src/lib.rs b/datafusion/wasmtest/src/lib.rs
index 9a4096a297..403509515b 100644
--- a/datafusion/wasmtest/src/lib.rs
+++ b/datafusion/wasmtest/src/lib.rs
@@ -79,7 +79,6 @@ pub fn basic_parse() {
mod test {
use std::sync::Arc;
- use super::*;
use bytes::Bytes;
use datafusion::datasource::file_format::file_compression_type::FileCompressionType;
use datafusion::{
@@ -106,11 +105,11 @@ mod test {
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
+ #[cfg(target_arch = "wasm32")]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
- #[cfg_attr(not(target_arch = "wasm32"), allow(dead_code))]
fn datafusion_test() {
- basic_exprs();
- basic_parse();
+ super::basic_exprs();
+ super::basic_parse();
}
fn get_ctx() -> Arc<SessionContext> {
diff --git a/test-utils/src/data_gen.rs b/test-utils/src/data_gen.rs
index 2228010b28..bb8fdad5a0 100644
--- a/test-utils/src/data_gen.rs
+++ b/test-utils/src/data_gen.rs
@@ -129,7 +129,7 @@ impl BatchBuilder {
}
}
- #[allow(clippy::too_many_arguments)]
+ #[expect(clippy::too_many_arguments)]
fn append_row(
&mut self,
rng: &mut StdRng,