Files
rust/tests
llogiq 819373451c Add allow-unwrap-types configuration for unwrap_used and expect_used (#16605)
rust-lang/rust-clippy#16535

This PR introduces a new configuration option, `allow-unwrap-types`,
which accepts a list of type paths (e.g., `["std::sync::LockResult"]`).
When configured, calling `.unwrap()` or `.expect()` on values of these
types will no longer trigger the `unwrap_used` or `expect_used` lints.

This is particularly useful for reducing noisy lints on patterns where
unwrapping is widely considered acceptable or expected by design, such
as obtaining a `std::sync::LockResult` from `Mutex::lock()`.

**Changes Made**
Introduced the `allow_unwrap_types: Vec<String>` field in
`clippy_config`.
Updated the `unwrap_expect_used` lint to check the underlying evaluated
expression `ty` against the configured allowed types.
Handled robust type alias resolution so that aliases like
`std::sync::LockResult` accurately map to their underlying `Adt` types
during lint evaluation.
Added UI tests in `tests/ui-toml/unwrap_used_allowed/` to verify both
allowed and disallowed cases.

----

changelog: [`unwrap_used`], [`expect_used`]: Add `allow-unwrap-types`
configuration to allow unwrapping specified types.
2026-02-21 21:59:26 +00:00
..
2026-02-21 21:52:58 +05:30