mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-03 09:19:18 +00:00
Refactor longest function to use lifetimes
This commit is contained in:
parent
b3fbab1791
commit
f996183355
@ -8,9 +8,7 @@
|
||||
// Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn longest(x: &str, y: &str) -> &str {
|
||||
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
|
||||
if x.len() > y.len() {
|
||||
x
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user