Until `if let` chains are stabilized, we do not collapse them together or with other `if` expressions unless the `let_chains` feature is enabled. This is the case for example in Clippy sources. This was made possible by converting the `collapsible_if` to a late lint to get access to the set of enabled features. This allows this PR to supersede #14455 and no longer require an additional configuration option. The three commits are, in order: - a conversion of the existing early lint to a late lint, with no new feature or tests changes - the addition of the `let_chains` feature detection and action, and tests - the application of the enhanced lint to Clippy sources (136 files modified) changelog: [`collapsible_if`]: recognize the rust compiler `let_chains` feature r? @flip1995 |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
clippy-utils
Helpful tools for writing lints, provided as they are used in Clippy.
Usage
This crate is only guaranteed to build with this nightly toolchain:
nightly-2025-03-20
To use clippy-utils in your lint, add the following to your Cargo.toml:
clippy_utils = "0.1.XY"
XY is the version of the nightly toolchain above and can be determined with rustc +nightly-YYYY-MM-DD -V.
⚠️ Stability ⚠️
No stability guarantees are made for this crate! Use at your own risk.
Function signatures can change or be removed without replacement without any prior notice.
LICENSE
Copyright 2014-2025 The Rust Project Developers
Licensed under the Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> or the MIT license <https://opensource.org/licenses/MIT>, at your option. Files in the project may not be copied, modified, or distributed except according to those terms.