I have this piece of code that works:
for line in content
.split('\n')
.collect::<Vec<_>>()
.iter()
.chain((&["output"]).iter())
I think there must be a way to use the iterator provided by split to obtain the same result without having to collect() into a vector.
When I try to change .collect::<Vec<_>>().iter() to into_iter() I get the following error:
error[E0271]: type mismatch resolving `<std::slice::Iter<'_, &str> as IntoIterator>::Item == &str`
--> src/main.rs:251:53
|
251 | for line in content.split('\n').into_iter().chain((&["output"]).iter()) {
| ^^^^^ expected `&str`, found `str`
|
= note: expected reference `&&str`
found reference `&str`
There are also other errors referring to the same line that basically say the same thing.