Indices, usually. for i in 0..particles.len() { for j in 0..particles.len() { if i == j { continue; } let d = particles[j].pos - particles[i].pos; particles[i].vel += d * k; } } Each indexing is a short borrow so there's no conflict. d is computed first and it's a plain value. People will tell you this is cheating. It isn't.