//in main
App::new().run("".to_string());
// complains
//temporary value dropped while borrowed
//creates a temporary which is freed while still in use
Why do you need the 'static lifetime for self? That tells the compiler self needs to be valid beyond the end of main, which is causing your compile error.
When the compiler tells you to add 'staticdon't listen to it. It's almost always a wrong, misleading suggestion.
When compiler says it wants 'static, it tries to say that all temporary references are forbidden. 'static just happens to be the only case of a reference that isn't temporary, but in practice it's a useless solution, because almost nothing in real programs can be static (i.e. a constant or leaked memory). The real solution is to use self-contained/owned types, Arc, or a copy of the data instead.