Skip to content

Enable a few more clippy lints - #10558

Open
emilk wants to merge 13 commits into
apache:mainfrom
emilk:emilk/many-more-clippy-lints
Open

Enable a few more clippy lints#10558
emilk wants to merge 13 commits into
apache:mainfrom
emilk:emilk/many-more-clippy-lints

Conversation

@emilk

@emilk emilk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

No issue in particular

Rationale for this change

There are a lot of lints we can enable to, which different abilities to:

  • Simplify the code
  • Write more efficient code
  • Catch bugs
  • etc

What changes are included in this PR?

One commit per new lint (maybe easiest to review commit by commit!).
Let me know if you disagree with any of them.

I hope to add even more lints in later PRs.

Are these changes tested?

Covered by existing tests plus the clippy CI job.

Are there any user-facing changes?

No.

@emilk
emilk force-pushed the emilk/many-more-clippy-lints branch 2 times, most recently from ca3b6c8 to 08b7c3e Compare August 5, 2026 15:47
@github-actions github-actions Bot removed parquet-derive parquet_derive crate arrow-ord labels Aug 5, 2026
emilk added 7 commits August 5, 2026 17:53
Parenthesizes shifts mixed with `|`. Applied with `cargo clippy --fix`;
`<<` already binds tighter than `|`, so this only makes the existing
grouping explicit.
Ten intra-doc links were written with `'` instead of backticks, so they
rendered as text instead of linking. The eight `['Err'](Result::Err)` cases
become just [`Err`], since the explicit target is redundant once the link
resolves. The remaining `["null", "string"]` is a JSON example rather than
a link, so it is now inline code.
Replaces `"".to_string()` and friends with `String::new()`, applied with
`cargo clippy --fix`. One site then tripped `unwrap_or_else(String::new)`,
which became `unwrap_or_default()`.
Drops explicit `.into_iter()` from `for` loops, applied with
`cargo clippy --fix`. One site then tripped `useless_vec`, so its `vec!`
became an array.
Replaces `.map(f).unwrap_or_default()` with `.is_some_and(f)`, applied with
`cargo clippy --fix`. The one negated case is spelled `is_none_or` instead,
matching the style already used elsewhere.
Rewrites `if let Pat = x` on unit-like patterns as `x == Pat` or
`matches!`, applied with `cargo clippy --fix`. The `tokenizer.next()` cases
still call `next()` exactly once, so nothing changes about consumption.
Drops `#` from raw strings that contain no quotes, applied with
`cargo clippy --fix`. Strings that do contain a `"` keep their hashes.
Uses `()` instead of `_` where the matched type is unit, applied with
`cargo clippy --fix`.
@emilk emilk changed the title Ten more clippy lints (stacked on #10552) Enable a few more clippy lints Aug 5, 2026
@emilk
emilk force-pushed the emilk/many-more-clippy-lints branch from 08b7c3e to dceda9d Compare August 5, 2026 16:01
@emilk
emilk marked this pull request as ready for review August 5, 2026 16:08
emilk and others added 4 commits August 5, 2026 18:47
Nests or-patterns, applied with `cargo clippy --fix`. Each group of
collapsed arms already shared a body, so match order and reachability are
unchanged.
Two of the `matches!` calls introduced by `equatable_if_let` read better as
equality comparisons. The remaining ones stay: `InferredType` has no
`PartialEq`, and `ParquetError` deliberately does not implement it (apache#4469).
Ten plain data strings left over from the `needless_raw_string_hashes`
commit. Raw strings are kept where they still earn their prefix: regex and
LIKE-pattern tables, and multi-line blocks that would otherwise need `\n`.
`arrow-cmp` was added after the workspace lints landed, so it was the
only member without `[lints] workspace = true`.

No fixes were needed: the crate is already clean under the full lint set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@emilk
emilk force-pushed the emilk/many-more-clippy-lints branch from c739058 to a50db5b Compare August 5, 2026 16:48
Comment thread arrow-avro/src/reader/mod.rs Outdated
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
@Jefffrey Jefffrey added the development-process Related to development process of arrow-rs label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants