This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 1f03ac502f chore: enforce clippy::allow_attributes for functions-*
crates (#18986)
1f03ac502f is described below
commit 1f03ac502f48f205a6eb6a69d408f58ffd792879
Author: Carlos Hurtado <[email protected]>
AuthorDate: Sun Nov 30 01:40:16 2025 -0600
chore: enforce clippy::allow_attributes for functions-* crates (#18986)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Part of https://github.com/apache/datafusion/issues/18881.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
> #[expect] attributes suppress the lint emission, but emit a warning,
if the expectation is unfulfilled. This can be useful to be notified
when the lint is no longer triggered.
> \-
https://rust-lang.github.io/rust-clippy/master/index.html?search=clippy%3A%3Aupper_case_acronyms
This is helpful to identify when the lint is no longer needed across
`functions-*` crates.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
Added `#![deny(clippy::allow_attributes)]` to all `functions-*` crates.
Also, the following lints are removed:
+
[`clippy::upper_case_acronyms`](https://rust-lang.github.io/rust-clippy/master/index.html?search=clippy%3A%3Aupper_case_acronyms)
is removed for
https://github.com/apache/datafusion/blob/487de9db6a546671011d28540ec639d4cf212288/datafusion/functions-aggregate/src/regr.rs#L88-L129
because it resulted in
```
warning: this lint expectation is unfulfilled
--> datafusion/functions-aggregate/src/regr.rs:89:10
|
89 | #[expect(clippy::upper_case_acronyms)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
warning: `datafusion-functions-aggregate` (lib) generated 1 warning
```
The rationale is the following: The default value of
`avoid-breaking-exported-api` is `true` so lint is suppressed.
[Ref](https://github.com/rust-lang/rust-clippy/blob/92b4b68683249c781c3acad742fc6e57c4140ad9/clippy_lints/src/upper_case_acronyms.rs#L128-L132).
Setting `avoid-breaking-exported-api` to `false` raises multiple
warnings as datafusion does not strictly follow [`UpperCamelCase` naming
convention](https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case).
+
[`clippy::too_many_arguments`](https://rust-lang.github.io/rust-clippy/master/index.html?search=clippy%3A%3Atoo_many_arguments#too_many_arguments)
is removed for
https://github.com/apache/datafusion/blob/487de9db6a546671011d28540ec639d4cf212288/datafusion/functions/src/regex/regexpinstr.rs#L289-L297
as default value of `too-many-arguments-threshold` is 7 and
`regexp_instr_inner` takes on 6 arguments.
+
[`rustdoc::redundant_explicit_links`](https://doc.rust-lang.org/rustdoc/lints.html#redundant_explicit_links)
is removed for (1)
https://github.com/apache/datafusion/blob/487de9db6a546671011d28540ec639d4cf212288/datafusion/functions/src/macros.rs#L79-L104
and (2)
https://github.com/apache/datafusion/blob/487de9db6a546671011d28540ec639d4cf212288/datafusion/functions/src/macros.rs#L106-L120
as it looks like computed automatic link for
``[`ScalarUDF`](datafusion_expr::ScalarUDF)`` is not the same as the
explicit link. Any concerns with this one?
+
[`rustdoc::private_intra_doc_links`](https://doc.rust-lang.org/rustdoc/lints.html#private_intra_doc_links)
is removed for (1)
https://github.com/apache/datafusion/blob/487de9db6a546671011d28540ec639d4cf212288/datafusion/functions-aggregate/src/approx_percentile_cont.rs#L242-L281
and (2)
https://github.com/apache/datafusion/blob/487de9db6a546671011d28540ec639d4cf212288/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs#L254-L259
since lint detects when [intra-doc
links](https://doc.rust-lang.org/rustdoc/write-documentation/linking-to-items-by-name.html)
from public to private items but `TDigest::to_scalar_state()` is public,
so we have the opposite case: from private to public items.
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
+ Ran `sh ci/scripts/rust_docs.sh` with no warnings/errors.
+ Ran `sh ci/scripts/rust_clippy.sh` with no warnings/errors.
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
No.
---
datafusion/functions-aggregate-common/src/lib.rs | 2 ++
datafusion/functions-aggregate/src/approx_percentile_cont.rs | 1 -
.../functions-aggregate/src/approx_percentile_cont_with_weight.rs | 1 -
datafusion/functions-aggregate/src/lib.rs | 2 ++
datafusion/functions-aggregate/src/regr.rs | 1 -
datafusion/functions-nested/src/lib.rs | 2 ++
datafusion/functions-table/src/lib.rs | 2 ++
datafusion/functions-window-common/src/lib.rs | 2 ++
datafusion/functions-window/src/cume_dist.rs | 2 +-
datafusion/functions-window/src/lead_lag.rs | 2 +-
datafusion/functions-window/src/lib.rs | 2 ++
datafusion/functions-window/src/rank.rs | 4 ++--
datafusion/functions/src/datetime/now.rs | 2 +-
datafusion/functions/src/lib.rs | 2 ++
datafusion/functions/src/macros.rs | 2 --
datafusion/functions/src/regex/regexpinstr.rs | 1 -
datafusion/functions/src/utils.rs | 1 -
17 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/datafusion/functions-aggregate-common/src/lib.rs
b/datafusion/functions-aggregate-common/src/lib.rs
index 468836f3ab..83e2efd0c5 100644
--- a/datafusion/functions-aggregate-common/src/lib.rs
+++ b/datafusion/functions-aggregate-common/src/lib.rs
@@ -33,6 +33,8 @@
// https://github.com/apache/datafusion/issues/18503
#![deny(clippy::needless_pass_by_value)]
#![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/src/approx_percentile_cont.rs
b/datafusion/functions-aggregate/src/approx_percentile_cont.rs
index 42ef835d97..b09d43bd8f 100644
--- a/datafusion/functions-aggregate/src/approx_percentile_cont.rs
+++ b/datafusion/functions-aggregate/src/approx_percentile_cont.rs
@@ -239,7 +239,6 @@ impl AggregateUDFImpl for ApproxPercentileCont {
self
}
- #[allow(rustdoc::private_intra_doc_links)]
/// See [`TDigest::to_scalar_state()`] for a description of the serialized
/// state.
fn state_fields(&self, args: StateFieldsArgs) -> Result<Vec<FieldRef>> {
diff --git
a/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs
b/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs
index adf07dede3..6a86ef2262 100644
--- a/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs
+++ b/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs
@@ -251,7 +251,6 @@ impl AggregateUDFImpl for ApproxPercentileContWithWeight {
Ok(Box::new(accumulator))
}
- #[allow(rustdoc::private_intra_doc_links)]
/// See [`TDigest::to_scalar_state()`] for a description of the serialized
/// state.
fn state_fields(&self, args: StateFieldsArgs) -> Result<Vec<FieldRef>> {
diff --git a/datafusion/functions-aggregate/src/lib.rs
b/datafusion/functions-aggregate/src/lib.rs
index 5454a902e4..de1e2f46d1 100644
--- a/datafusion/functions-aggregate/src/lib.rs
+++ b/datafusion/functions-aggregate/src/lib.rs
@@ -26,6 +26,8 @@
// 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-aggregate/src/regr.rs
b/datafusion/functions-aggregate/src/regr.rs
index 44ce0bd48e..f78d463585 100644
--- a/datafusion/functions-aggregate/src/regr.rs
+++ b/datafusion/functions-aggregate/src/regr.rs
@@ -86,7 +86,6 @@ impl Regr {
}
#[derive(Debug, Clone, PartialEq, Hash, Eq)]
-#[allow(clippy::upper_case_acronyms)]
pub enum RegrType {
/// Variant for `regr_slope` aggregate expression
/// Returns the slope of the linear regression line for non-null pairs in
aggregate columns.
diff --git a/datafusion/functions-nested/src/lib.rs
b/datafusion/functions-nested/src/lib.rs
index 51210b9ae2..1777198860 100644
--- a/datafusion/functions-nested/src/lib.rs
+++ b/datafusion/functions-nested/src/lib.rs
@@ -26,6 +26,8 @@
// https://github.com/apache/datafusion/issues/18503
#![deny(clippy::needless_pass_by_value)]
#![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 f099a186ec..6d8a7a988c 100644
--- a/datafusion/functions-table/src/lib.rs
+++ b/datafusion/functions-table/src/lib.rs
@@ -26,6 +26,8 @@
// 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 c35b9a6c84..56d23d2073 100644
--- a/datafusion/functions-window-common/src/lib.rs
+++ b/datafusion/functions-window-common/src/lib.rs
@@ -26,6 +26,8 @@
// 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/cume_dist.rs
b/datafusion/functions-window/src/cume_dist.rs
index 372086b12d..536526e784 100644
--- a/datafusion/functions-window/src/cume_dist.rs
+++ b/datafusion/functions-window/src/cume_dist.rs
@@ -167,7 +167,7 @@ mod tests {
}
#[test]
- #[allow(clippy::single_range_in_vec_init)]
+ #[expect(clippy::single_range_in_vec_init)]
fn test_cume_dist() -> Result<()> {
test_f64_result(0, vec![], vec![])?;
diff --git a/datafusion/functions-window/src/lead_lag.rs
b/datafusion/functions-window/src/lead_lag.rs
index 75a6f1fe43..b3d8a55065 100644
--- a/datafusion/functions-window/src/lead_lag.rs
+++ b/datafusion/functions-window/src/lead_lag.rs
@@ -640,7 +640,7 @@ impl PartitionEvaluator for WindowShiftEvaluator {
// OR
// - ignore nulls mode and current value is null and is within window
bounds
// .unwrap() is safe here as there is a none check in front
- #[allow(clippy::unnecessary_unwrap)]
+ #[expect(clippy::unnecessary_unwrap)]
if !(idx.is_none() || (self.ignore_nulls &&
array.is_null(idx.unwrap()))) {
ScalarValue::try_from_array(array, idx.unwrap())
} else {
diff --git a/datafusion/functions-window/src/lib.rs
b/datafusion/functions-window/src/lib.rs
index 1050c1b737..c9ed195ec4 100644
--- a/datafusion/functions-window/src/lib.rs
+++ b/datafusion/functions-window/src/lib.rs
@@ -26,6 +26,8 @@
// 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)]
//! Window Function packages for [DataFusion].
//!
diff --git a/datafusion/functions-window/src/rank.rs
b/datafusion/functions-window/src/rank.rs
index 6d891e7667..0dc8923849 100644
--- a/datafusion/functions-window/src/rank.rs
+++ b/datafusion/functions-window/src/rank.rs
@@ -381,7 +381,7 @@ mod tests {
test_i32_result(expr, vec![0..2, 2..3, 3..6, 6..7, 7..8], expected)
}
- #[allow(clippy::single_range_in_vec_init)]
+ #[expect(clippy::single_range_in_vec_init)]
fn test_without_rank(expr: &Rank, expected: Vec<u64>) -> Result<()> {
test_i32_result(expr, vec![0..8], expected)
}
@@ -434,7 +434,7 @@ mod tests {
}
#[test]
- #[allow(clippy::single_range_in_vec_init)]
+ #[expect(clippy::single_range_in_vec_init)]
fn test_percent_rank() -> Result<()> {
let r = Rank::percent_rank();
diff --git a/datafusion/functions/src/datetime/now.rs
b/datafusion/functions/src/datetime/now.rs
index 4723548a45..65f0b8e19b 100644
--- a/datafusion/functions/src/datetime/now.rs
+++ b/datafusion/functions/src/datetime/now.rs
@@ -148,7 +148,7 @@ impl ScalarUDFImpl for NowFunc {
mod tests {
use super::*;
- #[allow(deprecated)]
+ #[expect(deprecated)]
#[test]
fn now_func_default_matches_config() {
let default_config = ConfigOptions::default();
diff --git a/datafusion/functions/src/lib.rs b/datafusion/functions/src/lib.rs
index 252914026b..cfda16db53 100644
--- a/datafusion/functions/src/lib.rs
+++ b/datafusion/functions/src/lib.rs
@@ -26,6 +26,8 @@
// https://github.com/apache/datafusion/issues/18503
#![deny(clippy::needless_pass_by_value)]
#![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/functions/src/macros.rs
b/datafusion/functions/src/macros.rs
index 471b0a053e..f0f3f9efa3 100644
--- a/datafusion/functions/src/macros.rs
+++ b/datafusion/functions/src/macros.rs
@@ -84,7 +84,6 @@ macro_rules! export_functions {
#[macro_export]
macro_rules! make_udf_function {
($UDF:ty, $NAME:ident, $CTOR:expr) => {
- #[allow(rustdoc::redundant_explicit_links)]
#[doc = concat!("Return a [`ScalarUDF`](datafusion_expr::ScalarUDF)
implementation of ", stringify!($NAME))]
pub fn $NAME() -> std::sync::Arc<datafusion_expr::ScalarUDF> {
// Singleton instance of the function
@@ -109,7 +108,6 @@ macro_rules! make_udf_function {
#[macro_export]
macro_rules! make_udf_function_with_config {
($UDF:ty, $NAME:ident) => {
- #[allow(rustdoc::redundant_explicit_links)]
#[doc = concat!("Return a [`ScalarUDF`](datafusion_expr::ScalarUDF)
implementation of ", stringify!($NAME))]
pub fn $NAME(config: &datafusion_common::config::ConfigOptions) ->
std::sync::Arc<datafusion_expr::ScalarUDF> {
std::sync::Arc::new(datafusion_expr::ScalarUDF::new_from_impl(
diff --git a/datafusion/functions/src/regex/regexpinstr.rs
b/datafusion/functions/src/regex/regexpinstr.rs
index 0115648665..cb32007924 100644
--- a/datafusion/functions/src/regex/regexpinstr.rs
+++ b/datafusion/functions/src/regex/regexpinstr.rs
@@ -286,7 +286,6 @@ fn regexp_instr(
}
}
-#[allow(clippy::too_many_arguments)]
fn regexp_instr_inner<'a, S>(
values: &S,
regex_array: &S,
diff --git a/datafusion/functions/src/utils.rs
b/datafusion/functions/src/utils.rs
index 5a2368a38e..74b7fa95cd 100644
--- a/datafusion/functions/src/utils.rs
+++ b/datafusion/functions/src/utils.rs
@@ -334,7 +334,6 @@ pub mod test {
}
use arrow::datatypes::DataType;
- #[allow(unused_imports)]
pub(crate) use test_function;
use super::*;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]