Compiler hallucinates on unused variable

⚓ Rust    📅 2025-12-05    👤 surdeus    👁️ 1      

surdeus

I'm sharing this mostly for the lulz, but it may be related to a compiler bug or overzealous error correction by it.

warning: unused variable: `pan_id`
  --> /home/neumann/RustroverProjects/ezsp/src/zigbee/network_manager/incoming_message.rs:22:13
   |
22 |         let pan_id = self.get_pan_id().await?;
   |             ^^^^^^
   |
   = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
help: if this is intentional, prefix it with an underscore
   |
22 |         let _pan_id = self.get_pan_id().await?;
   |             +
help: you might have meant to pattern match on the similarly named constant `HOME_GATEWAY`
   |
22 -         let pan_id = self.get_pan_id().await?;
22 +         let zigbee::network_manager::builder::HOME_GATEWAY = self.get_pan_id().await?;
   |

I especially found the similarly named part hilarious. :smiley:

2 posts - 2 participants

Read full topic

🏷️ Rust_feed