Open
Description
Summary
Result::unwrap_or_default()
should not be suggested if the MSRV is not at least 1.16.
Reproducer
I tried this code:
#[clippy::msrv = "1.15"]
fn f(foo: Result<Vec<u32>, &'static str>) -> Vec<u32> {
foo.unwrap_or(vec![])
}
fn main() {
}
I expected to see this happen: no suggestion of Result::unwrap_or_default()
Instead, this happened:
5 | foo.unwrap_or(vec![])
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
Version
rustc 1.89.0-nightly (2eef47813 2025-05-22)
binary: rustc
commit-hash: 2eef47813f25df637026ce3288880e5c587abd92
commit-date: 2025-05-22
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
Additional Labels
@rustbot label +I-suggestion-causes-error "+good first issue"