diff --git a/Cargo.toml b/Cargo.toml index b9d8b1a69ef61..78b7fccdf8808 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -200,6 +200,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/file_stream_provider.rs b/datafusion-examples/examples/custom_data_source/file_stream_provider.rs index 936da0a33d47b..5b43072d43f80 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 d2ddff82e32db..9781a93374ea6 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>>, } @@ -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>> { 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 78b3aaa05a188..e55aaa7250ea7 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(&self, req: &Request) -> Result, 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 { 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, 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 28bd880ea01fb..9efb5aa96267e 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 d1cd3998fecf1..931941e8fdfad 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 fdbfe7f2390ca..cf45ccf3ef63a 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 df6659c6f843c..fdd04f752455e 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 630bc056600b4..accd51ae5861c 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 17ebca52cd1d2..9b1f59adc6823 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 74a10bf079e61..2466d42692192 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 { 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>, @@ -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>) -> Vec { functions .iter() diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rs index e83934a8e281d..3815d650ae60c 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 84cf97710a902..88d2846a9110c 100644 --- a/datafusion/core/tests/custom_sources_cases/dml_planning.rs +++ b/datafusion/core/tests/custom_sources_cases/dml_planning.rs @@ -94,7 +94,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>>>, diff --git a/datafusion/core/tests/execution/coop.rs b/datafusion/core/tests/execution/coop.rs index 380a47505ac2d..7bd66c1936491 100644 --- a/datafusion/core/tests/execution/coop.rs +++ b/datafusion/core/tests/execution/coop.rs @@ -762,7 +762,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 36cc769417dbc..3d99cc72fa590 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 bf71053d6c852..fe31098622c58 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 0d04e98536f2a..7bb6177c31010 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 ce422494db101..4a672d7e56f84 100644 --- a/datafusion/core/tests/fuzz_cases/join_fuzz.rs +++ b/datafusion/core/tests/fuzz_cases/join_fuzz.rs @@ -1086,7 +1086,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> { 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 c424a314270c6..8f3b8ea05324c 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::(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 48f0103113cf6..9fd60cd1f06f3 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 e3a191ee9ade2..4c0bced984ed7 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 cbfd7887093e7..4816a45942e5a 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 22c40e203a014..5ad209591e380 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 d58ce1188550c..fdfee05d86a79 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 3d27d4cc5ef5a..c39ee2cd9377d 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 d7e92f70afa99..0e137a706fad7 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 2965be7637899..f80c9cb0b0daa 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 836cb9345b51f..591a5a62f3b20 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 aced2f46d7224..1a8da9459ae10 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 2be066beaad24..0018694d18eeb 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 4fb78933d7a5c..eb25f173248c3 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 bf0cf9b122c1c..2ca9b8f6f495a 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 61b880095047c..574d160d4214a 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 d7f687386333f..793c2aac96293 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::().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 711bbe5a3c4df..48f71858c1204 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 f364b785ddaed..1b9996220d882 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 ed9e1af4eaa8f..9ac6911236e40 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 1783c15b14b58..cd9ade041acbf 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 210e54d672893..301f2c34a6c95 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 300313387388a..6edfb92744f5b 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 29bbc3f7dcb48..ad2b10e201f8f 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( group: &mut BenchmarkGroup<'_, M>, trim_func: &ScalarUDF, @@ -189,7 +189,7 @@ fn run_with_string_type( ); } -#[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 f88304a6a5f8d..b9ce113efa627 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 27f73fd955380..ce9e7d55ef103 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 a1a59cb348876..c4ee23517b4df 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 d7c750e4a1a1c..1d86a98b5fced 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 84378a3d26eee..b6eaacdca2505 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 988e14c28e17c..bedd348dab92f 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 e98772291cbeb..3a0d79ae2d234 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 ec8e154caec91..10688effac104 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 08cd75b622db3..9c2ca9385aa5e 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 b7e1c906d90f5..6f7fb7b89c0c4 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 adf5125457c14..ca32b1500d57b 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 e30d2a22348cd..7ddc930fa257e 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 9f8142447ba69..be17f29eaafa0 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 3d3cb541b5a5e..11f734e757452 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 aad3ceed68ce3..fc17eef1e6656 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 b21eb52920ab5..7fef670933f9a 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 6a3d3944e4e81..b0cf32266ea31 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 407408aaa71b3..0819fd3a592f9 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 c5948bd7343a6..6ccf017ee9ab4 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 datafusion::{ arrow::{ array::{ArrayRef, Int32Array, RecordBatch, StringArray}, @@ -102,11 +101,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 { diff --git a/test-utils/src/data_gen.rs b/test-utils/src/data_gen.rs index 2228010b28dd1..bb8fdad5a0f89 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,