This is determined by lifetime elision [1]. Specifically (quoting):
- Each elided lifetime in the parameters becomes a distinct lifetime parameter.
- If there is exactly one lifetime used in the parameters (elided or not), that lifetime is assigned to all elided output lifetimes.
So, Since the signature has one `&str` as a parameter, the lifetime is assigned to the output lifetime also per these rules.
[1]: https://doc.rust-lang.org/reference/lifetime-elision.html
(Edited to improve formatting)