Closed as not planned
Description
Lint Name
needless_borrow
Reproducer
I tried this code:
struct Object;
impl Object {
fn str_getter(&self) -> Option<&str> {
None
}
}
fn main() {
let o = Object;
if let Some(s) = &o.str_getter() {
println!("{s}");
}
}
I expected to see this happen: needless_borrow
triggering for &o.str_getter()
Instead, this happened: nothing
Version
Tested on Rust playground, hence less info. Let me know if you need me to reproduce locally.
Nightly version: 1.73.0-nightly
(2023-08-10 439d066bcf9496b1b8c8)