chore: enforce clippy::allow_attributes for 7 crates#19133
Conversation
…ution/expr/ffi/catalog-listing/core-crates # Conflicts: # datafusion/doc/src/lib.rs
…ution/expr/ffi/catalog-listing/core-crates
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| #![cfg_attr(test, allow(clippy::needless_pass_by_value))] |
There was a problem hiding this comment.
Is removing the existing allow for needless_pass_by_value in tests intentional?
There was a problem hiding this comment.
Yes, the CI was failing with "unfulfilled lint expectations" because the needless_pass_by_value lint wasn't actually being triggered in the test code.
There was a problem hiding this comment.
We might need to think of a way to keep this, as the intention is that for any future tests we have this lint disabled
datafusion/core/src/lib.rs
Outdated
| )] | ||
| #![warn(missing_docs, clippy::needless_borrow)] | ||
| #![cfg_attr(test, allow(clippy::needless_pass_by_value))] | ||
| #![cfg_attr(test, expect(clippy::needless_pass_by_value))] |
There was a problem hiding this comment.
Is changing the allow to expect is strictly necessary here?
There was a problem hiding this comment.
Not required here, but i think the expect gives us better feedback when code improves.
…-to-doc/execution/expr/ffi/catalog-listing/core-crates' into chore-add-clippyallow_attributes-to-doc/execution/expr/ffi/catalog-listing/core-crates
…ution/expr/ffi/catalog-listing/core-crates
alamb
left a comment
There was a problem hiding this comment.
This PR looks better than what is on main to me. Thank you @chakkk309 and @Jefffrey
| // TODO(clippy): This clippy `allow` should be removed if | ||
| // the manual `PartialEq` is removed in favor of a derive. | ||
| // (see `PartialEq` the impl for details.) | ||
| #[allow(clippy::allow_attributes)] |
There was a problem hiding this comment.
why not change this
#[expect(clippy::derived_hash_with_manual_eq)]?
There was a problem hiding this comment.
Hi, if we change #[allow(clippy::derived_hash_with_manual_eq)] to
#[expect(clippy::derived_hash_with_manual_eq)], that will be the error:
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
--> datafusion/expr/src/logical_plan/plan.rs:3239:28
|
3239 | #[derive(Debug, Clone, Eq, Hash)]
| ^^^^
|
note: `PartialEq` implemented here
--> datafusion/expr/src/logical_plan/plan.rs:3248:1
|
3248 | impl PartialEq for Extension {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#derived_hash_with_manual_eq
= note: `#[deny(clippy::derived_hash_with_manual_eq)]` on by default
warning: this lint expectation is unfulfilled
--> datafusion/expr/src/logical_plan/plan.rs:3238:10
|
3238 | #[expect(clippy::derived_hash_with_manual_eq)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
warning: `datafusion-expr` (lib) generated 1 warning
error: could not compile `datafusion-expr` (lib) due to 1 previous error; 1 warning emitted
Seems like expect can't override clippy's default deny-level lint derived_hash_with_manual_eq :(, so maybe we need allow with a policy override here.
…ution/expr/ffi/catalog-listing/core-crates
|
I think this PR is ready to go. @Jefffrey do you see any reason not to merge this? |
Jefffrey
left a comment
There was a problem hiding this comment.
I think we can merge this, I'm just a bit unclear on some of the implications relating to the cfg_attr for tests; I don't know how they interact for example, and playing around locally with:
- #![cfg_attr(test, allow(clippy::needless_pass_by_value))]
+ #![cfg_attr(test, expect(clippy::needless_pass_by_value))]I'm having a hard time understanding what exactly is the semantics here 🤔
Also removing some of the existing #![cfg_attr(test, allow(clippy::needless_pass_by_value))] in tests might make them drift with the rest of the test codebase as I assume people in the future running into this lint probably wouldn't add this exception back?
I see what you mean :) , |
I think it was a conscious decision to use |
So how about we change it back to |
…-to-doc/execution/expr/ffi/catalog-listing/core-crates' into chore-add-clippyallow_attributes-to-doc/execution/expr/ffi/catalog-listing/core-crates
Thanks for the feedback! |
|
Took the liberty of pushing some fixes to hopefully get this PR over the line: 27835f5 |
|
Thanks @chakkk309 & @alamb |
Which issue does this PR close?
Part of #18881
Rationale for this change
Implement clippy::allow_attributes lint for 7 crates
What changes are included in this PR?
Core crates modified:
Are these changes tested?
yes
Are there any user-facing changes?
No