It's not important which exact iterator is used inside, but it has a lifetime specifier! Now, what does this mean?
It means that a Lines has a reference to some data somewhere else. In this case the string. This means that you could keep on using the string after inspecting it using the Lines iterator. Note that since the string you are iterating over is created inside the function, you cannot return a reference to it, which is the root of the problem.
Ultimately, the Lines does not own the data, so it must be owned somewhere else, but this is currently inside the function, and since it is not returned it will be destroyed at the end of the function.
There are two solutions:
Return a String instead of a Lines and let the caller split it up into lines.
Return a Vec<String> where each string is a line.
The reason that both of these work is that they return owned data. A String owns the data inside, and so does a Vec. Note that you can use lines to create the vector:
The map here is necessary because each line is of type &str and therefore borrows the data, so I convert it using to_string, which creates a String that owns the data.