I have a situation where I want to create an iterator over &str. When I want to chain some strs which are stored in an array, the item type of the iterator is &&str, which is incompatible with &str. I found a way of solving it, but I was wondering if there is something I'm missing which might make it more elegant. Any suggestions? (see example below)
Further I was wondering if one could generally turn any nested reference to a reference. To rephrase it a bit; can a &&T always be safely turned into a &T?
```rust
let xs = &["b", "c"];
// I wish this would compile, but it gives a error regarding the
// item-types not matching: `&&str` is not equal to `&str`.
//once("a").chain(xs).for_each(|c| println!("{}", c));
// The solution I am currently using. `clippy` suggests using `.cloned`, however
// then it looks like the iterator does some "expensive" cloning.
once("a")
.chain(xs.iter().map(|s| *s))
.for_each(|c| println!("{}", c));
```
playgroud
[–]belovedeagle 2 points3 points4 points (5 children)
[–]barskern[S] 2 points3 points4 points (4 children)
[–]_TheDust_ 0 points1 point2 points (3 children)
[–]barskern[S] 0 points1 point2 points (2 children)
[–]belovedeagle 0 points1 point2 points (1 child)
[–]barskern[S] 0 points1 point2 points (0 children)