This one seems convoluted at first, but remember that String and &str are different beasts.
String can live and be used on its own, but &str is just a reference to part of String. So, &str can live as long as referenced String lives. Lets see how it should work on return signatures.
let title_text = title .text() .trim();
// ^ ^ ^
// Node String <- &str
-
Here,
titleis aselect::Node. -
Node::textreturns aString, but nothing binds it to context. -
String::trim, in turn, returns a&strwhich is a reference to part ofStringitself.
In the end, the borrow checker just doesn’t understand how it should process a reference to String that will not live long enough in context, as it is a temporary value (non-bound).