Commit c7cfdae
fix(windows): Suppress unused variable warnings in discovery.rs
## Problem
Windows builds were generating 6 warnings in the discovery module:
- 3 x "unused variable: `iter`"
- 3 x "variable does not need to be mutable"
These warnings appeared in all Windows build steps (Build, Run tests, Build release)
due to platform-specific conditional compilation.
## Root Cause
On Windows, the `iter` variable is created but never used because:
1. Unix uses: `iter.next_with_timeout(Duration::from_millis(100))`
2. Windows uses: `Ok(None)` (method doesn't exist on Windows)
The `iter` variable is necessary for Unix but unused on Windows, causing
the compiler to warn about unused mutable variables.
## Solution
Added `#[cfg_attr(windows, allow(unused_variables, unused_mut))]` attributes
to all 3 iterator creation sites:
**Line 203**: ICMP Echo Request iterator
**Line 284**: ICMPv6 Echo Request iterator
**Line 407**: NDP Neighbor Solicitation iterator
This tells the compiler to suppress these warnings only on Windows builds,
where the variables are legitimately unused.
## Testing
**Linux**: ✅ ALL PASS
- cargo build --release: 0 warnings
- cargo clippy: 0 warnings
- cargo test: 270 passed, 5 ignored
**Expected Windows**: ✅ 0 warnings
- All 6 warnings will be suppressed by cfg_attr
## Technical Details
**Approach**: Platform-specific warning suppression
- Unix: Uses `iter` normally, no warnings
- Windows: Suppresses warnings for intentionally unused variable
**Alternative Approaches Considered**:
1. ❌ Remove `iter` on Windows - breaks code structure
2. ❌ Use `_iter` prefix - doesn't fix "unused mut" warning
3. ✅ `cfg_attr` - Clean, explicit, platform-specific
## Impact
- Zero functional changes
- Cleaner Windows build output (0 warnings)
- Better CI experience (no noise in logs)
- Makes actual warnings more visible
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent d836112 commit c7cfdae
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| |||
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| 284 | + | |
283 | 285 | | |
284 | 286 | | |
285 | 287 | | |
| |||
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | 410 | | |
| |||
0 commit comments