Rust_2024_compatibility lint and the if let temporary scope

Okay, I think I got it reproduced now, anyway. This is firing for most Error types with a destructor (only exception being the ones from the standard library that have been explicitly marked as “insignificant”). I would agree that this particular case seems particularly useless to lint against since the destructor of the whole Result isn’t really doing anything in your else case, if the pattern accepts any Err(_) – unless the Ok variant’s data also has a nontrivial destructor.

So regarding…

yeah, maybe the lint is less smart here than it could be.

2 Likes