Comment

Comment by blinkingled

> for i in 0..(xs.len()) { let x = xs[i]; // do something with x } > should really be this:

> for x in &xs { // do something with x }

I am curious why the compiler can't rewrite the former to the latter?

parent blinkingled 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton