In these two examples is there any benefit in using .iter() in a for loop?
let chars = ['g', 'd', 'k', 'k', 'n'];
for i in chars {
    println!("{}", i);
}
let chars = ['g', 'd', 'k', 'k', 'n'];
for i in chars.iter() {
    println!("{}", i);
}
In these two examples is there any benefit in using .iter() in a for loop?
let chars = ['g', 'd', 'k', 'k', 'n'];
for i in chars {
    println!("{}", i);
}
let chars = ['g', 'd', 'k', 'k', 'n'];
for i in chars.iter() {
    println!("{}", i);
}
for i in array is interpreted by the compiler as for i in array.into_iter().
This means that you are iterating over elements of type char, and the array is copied (as an array is Copy if its elements are also Copy).
On the other hand, for i in array.iter() references the array instead iterates over elements of type &char, avoiding a copy.