Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions datafusion-examples/examples/data_io/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>>,
}

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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}");
Expand Down
5 changes: 0 additions & 5 deletions datafusion-examples/examples/flight/sql_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,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
Expand All @@ -141,7 +140,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())
Expand All @@ -150,7 +148,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())
Expand Down Expand Up @@ -198,13 +195,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(())
Expand Down
1 change: 0 additions & 1 deletion datafusion/catalog-listing/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion datafusion/catalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//!
Expand Down
1 change: 0 additions & 1 deletion datafusion/common-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion datafusion/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions datafusion/core/benches/data_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/benches/preserve_file_partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
27 changes: 1 addition & 26 deletions datafusion/core/src/bin/print_functions_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>,
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion datafusion/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/tests/custom_sources_cases/dml_planning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mutex<Option<Vec<Expr>>>>,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/tests/execution/coop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,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,
}

Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/tests/fifo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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![
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/tests/fuzz_cases/join_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<RecordBatch>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/tests/macro_hygiene/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -84,7 +84,7 @@ mod config_field {

impl std::error::Error for E {}

#[allow(dead_code)]
#[expect(dead_code)]
#[derive(Default)]
struct S;

Expand Down
1 change: 0 additions & 1 deletion datafusion/core/tests/parquet/filter_pushdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-arrow/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-avro/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-csv/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-json/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-parquet/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion datafusion/doc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion datafusion/execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion datafusion/expr-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading