why fn return &str should static lifetime, but struct's fn not?
fn say() -> &str {
"this is str"
}
// consider using the `'static` lifetime: `&'static `
but cat.hi ,is correct
struct Cat {}
impl Cat {
fn hi(&self) -> &str {
"hi"
}
}
why fn return &str tips consider using the 'static lifetime: &'static , but struct fn not?