Factor length function calls out of loop test clauses
Created by: yawaramin
Reproduction: see e.g. https://github.com/redox-os/redox/search?utf8=%E2%9C%93&q=while+len
Expected behavior: collection length calculations should be done once before iteration loops start, e.g.
let buf_len = buf.len();
while i < buf_len { ... }
Actual behavior: length calculations are repeated in every loop iteration, e.g.
while i < buf.len() { ... }
Build information: as of current master
, i.e. https://github.com/redox-os/redox/commit/45ad8047a4e756c54e25d9094f45815acc452557