gchp / iota

A terminal-based text editor written in Rust
MIT License
1.63k stars 81 forks source link

Rename iterators::Chars::enumerate to indices for clarity #96

Closed crespyl closed 9 years ago

crespyl commented 9 years ago

This should help make sure that calls to iter.enumerate work as expected

gchp commented 9 years ago

Any idea why this is causing tests to fail?

src/iota/buffer.rs:1000:23: 1000:29 error: type `core::iter::Rev<iterators::Chars<'_>>` does not implement any method in scope named `next`
src/iota/buffer.rs:1000         assert!(chars.next().unwrap() == 'T');
                                              ^~~~~~
src/iota/buffer.rs:1001:23: 1001:29 error: type `core::iter::Rev<iterators::Chars<'_>>` does not implement any method in scope named `next`
src/iota/buffer.rs:1001         assert!(chars.next().unwrap() == '͈');
                                              ^~~~~~
src/iota/buffer.rs:1002:23: 1002:29 error: type `core::iter::Rev<iterators::Chars<'_>>` does not implement any method in scope named `next`
src/iota/buffer.rs:1002         assert!(chars.next().unwrap() == 't');
crespyl commented 9 years ago

Herp derp. I also changed rev to reverse so it wouldn't conflict with the stdlib version. reverse should be "in-place" and change the direction without changing the type of the iterator, rev is from the stdlib IteratorExt trait and wraps the iterator with a different type struct.