Enable more clippy lints (part 3/3) - #25081
Draft
emilk wants to merge 7 commits into
Draft
Conversation
`String::new()` instead of `"".to_string()` / `"".to_owned()` / `"".into()`, which skips the copy-from-empty-slice path. All sites fixed by `cargo clippy --fix`.
`Ok(())` instead of `Ok(_)` where the payload is `()`, so the pattern stops matching silently if the type ever gains a payload.
Dropped `else` blocks after a branch that already diverges, removing one level of indentation at each site.
Nested the or-patterns, e.g. `Time32(Microsecond) | Time32(Nanosecond)` -> `Time32(Microsecond | Nanosecond)`, so the shared prefix is written once.
`if`/`else` instead of `match` on a bool. Two sites cascaded into `redundant_else`, fixed in the same commit.
Manual `Debug` impls that skip a field now end in `finish_non_exhaustive()`, so the output says a field was omitted instead of implying the struct only has the ones listed. `Column` keeps `finish()` under an `#[expect]`: its `Debug` output appears verbatim in user-facing error messages.
Prefer the positive condition first: `if x { .. } else { .. }` rather than
`if !x { .. } else { .. }`, so the reader does not have to negate mentally
to follow which branch runs.
Mostly `cargo clippy --fix`. Comments that described the negated branch were
moved to the branch they actually describe, and thirteen sites in
datafusion-sql were done by hand because one suggestion in that crate did not
type-check, which made rustfix roll back the whole crate.
This was referenced Sep 8, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25081 +/- ##
==========================================
- Coverage 81.74% 81.74% -0.01%
==========================================
Files 1128 1128
Lines 416644 416626 -18
Branches 416644 416626 -18
==========================================
- Hits 340592 340570 -22
- Misses 55995 56003 +8
+ Partials 20057 20053 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Clippychecks in CI #18467.Rationale for this change
Part 3 of 3, split out of #24848. Stacked on parts 1 and 2, so review those first:
Turn on more
clippy::pedanticlints from the opt-out list inCargo.toml.What changes are included in this PR?
if_not_elseMostly
cargo clippy --fix. Comments that described the negated branch moved tothe branch they describe, and thirteen sites in
datafusion-sqlwere done byhand because one suggestion there did not type-check, which made rustfix roll
back the whole crate.
Let me know if you disagree and I'll revert it.
What is the testing strategy for this PR?
Clippy is clean both with
--all-featuresand with default features. Thechanges are mechanical, so no new tests.
Are there any user-facing changes?
No