Simplified example with lifetimes specified
This commit is contained in:
parent
fc13310be8
commit
7141085747
@ -6,11 +6,7 @@ fn main() {
|
||||
println!("The longest string is {result}");
|
||||
}
|
||||
|
||||
fn longest<'a, 'b, 'out>(a: &'a str, b: &'b str) -> &'out str
|
||||
where
|
||||
'a: 'out,
|
||||
'b: 'out,
|
||||
{
|
||||
fn longest<'a>(a: &'a str, b: &'a str) -> &'a str {
|
||||
if a.len() > b.len() {
|
||||
a
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user