Rust E0502: Cannot borrow as mutable because also borrowed as immutable
Deterministic patch indexed for AI coding agents (Cursor, Claude Code, Cline, Windsurf, OpenDevin).
Root Cause: Collect keys/clones to drop immutable reference before mutating.
rust fix --latest
Deterministic patch indexed for AI coding agents (Cursor, Claude Code, Cline, Windsurf, OpenDevin).
- for item in &self.items { self.mutate(item); }
+ let ids: Vec<_> = self.items.iter().map(|i| i.id).collect();
+ for id in ids { self.mutate_by_id(id); }
curl -X POST https://agentnow.in/api/v1/query \
-H "Content-Type: application/json" \
-d '{"error": "Rust E0502: Cannot borrow as mutable because also borrowed as immutable"}'