How to fix Rust E0515 cannot return reference to local variable

Fix Rust E0515 by returning owned data or a reference tied to an input argument instead of a local variable.

Fix E0515 by returning an owned value (like a String) or a reference with a lifetime tied to an input argument, rather than a reference to a local variable.

fn get_data() -> String {
    let local = String::from("hello");
    local // Return the owned value, not &local
}

fn get_slice(input: &str) -> &str {
    input // Return a reference tied to the input lifetime
}