Removed unneccessary _iter suffixes from various APIs

This commit is contained in:
Marvin Löbel 2013-11-23 11:18:51 +01:00
parent b42c438892
commit 24b316a3b9
63 changed files with 473 additions and 469 deletions

View file

@ -128,7 +128,7 @@ fn make_masks() -> ~[~[~[u64]]] {
let mut cur_piece = ~[];
for dy in range(0, 10) {
for dx in range(0, 5) {
let masks =
let masks =
trans.iter()
.filter_map(|t| mask(dy, dx, id, *t))
.collect();
@ -192,7 +192,7 @@ fn to_utf8(raw_sol: &List<u64>) -> ~str {
// Prints a solution in ~str form.
fn print_sol(sol: &str) {
for (i, c) in sol.iter().enumerate() {
for (i, c) in sol.chars().enumerate() {
if (i) % 5 == 0 {println("");}
if (i + 5) % 10 == 0 {print(" ");}
print!("{} ", c);
@ -220,7 +220,7 @@ fn handle_sol(raw_sol: &List<u64>, data: &mut Data) -> bool {
// reverse order, i.e. the board rotated by half a turn.
data.nb += 2;
let sol1 = to_utf8(raw_sol);
let sol2: ~str = sol1.iter().invert().collect();
let sol2: ~str = sol1.chars().invert().collect();
if data.nb == 2 {
data.min = sol1.clone();

View file

@ -76,7 +76,7 @@ impl Sudoku {
let line = match reader.read_line() {
Some(ln) => ln, None => break
};
let comps: ~[&str] = line.trim().split_iter(',').collect();
let comps: ~[&str] = line.trim().split(',').collect();
if comps.len() == 3u {
let row = from_str::<uint>(comps[0]).unwrap() as u8;

View file

@ -16,7 +16,7 @@ pub fn main() {
assert_eq!(y, 6);
let s = ~"hello there";
let mut i: int = 0;
for c in s.byte_iter() {
for c in s.bytes() {
if i == 0 { assert!((c == 'h' as u8)); }
if i == 1 { assert!((c == 'e' as u8)); }
if i == 2 { assert!((c == 'l' as u8)); }

View file

@ -16,23 +16,23 @@ pub fn main()
let all_nuls4 = "\x00\u0000\0\U00000000";
// sizes for two should suffice
assert_eq!(all_nuls1.len(), 4);
assert_eq!(all_nuls1.len(), 4);
assert_eq!(all_nuls2.len(), 4);
// string equality should pass between the strings
assert_eq!(all_nuls1, all_nuls2);
assert_eq!(all_nuls2, all_nuls3);
assert_eq!(all_nuls3, all_nuls4);
// all extracted characters in all_nuls are equivalent to each other
for c1 in all_nuls1.iter()
for c1 in all_nuls1.chars()
{
for c2 in all_nuls1.iter()
for c2 in all_nuls1.chars()
{
assert_eq!(c1,c2);
}
}
// testing equality between explicit character literals
assert_eq!('\0', '\x00');
assert_eq!('\u0000', '\x00');

View file

@ -41,7 +41,7 @@ pub fn main() {
fn check_str_eq(a: ~str, b: ~str) {
let mut i: int = 0;
for ab in a.byte_iter() {
for ab in a.bytes() {
info!("{}", i);
info!("{}", ab);
let bb: u8 = b[i];

View file

@ -16,7 +16,7 @@ pub fn main() {
// Chars of 1, 2, 3, and 4 bytes
let chs: ~[char] = ~['e', 'é', '€', '\U00010000'];
let s: ~str = str::from_chars(chs);
let schs: ~[char] = s.iter().collect();
let schs: ~[char] = s.chars().collect();
assert!(s.len() == 10u);
assert!(s.char_len() == 4u);