spurious diagnostic: Variable `None` should have snake_case name

Author: ConradIrwinCreated Apr 28, 2025Updated Sep 16, 2026
LabelsC-bugA-vfs

rust-analyzer version: 2025-04-28 (and I think the few releases prior)

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: Zed

relevant settings: None

repository link (if public, optional): https://github.com/zed-industries/zed

code snippet to reproduce:

rust
// add your code here

I haven't been able to figure out a minimal reproduction for this yet, but across the Zed team, we've noticed that sometimes (maybe 1-10% of the time?) when first starting Zed with rust-analyzer we'll get a spurious diagnostic:

Image

It's also not clear how to get rid of this. Sometimes it seems to go away, other times I get frustrated and resort to cargo clean followed by restarting Zed.

It looks like it's not unique to Zed: https://github.com/rust-lang/rust-analyzer/issues/17759#issuecomment-2829939900.

I can keep looking out for things that seem to cause this, and am happy to try and test any hypothesis you have for why it might happen