From ac50cbe0aa0ba0aa0e13ff132c09f78c468b2c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BA=E5=85=B0=E6=98=9F=E8=BE=B0?= Date: Tue, 15 Nov 2022 20:39:11 +0800 Subject: [PATCH] remove unnecessary lifetime tag the lifetime tag of the longest function might be unnecessary and should be removed --- src/advance/lifetime/basic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/advance/lifetime/basic.md b/src/advance/lifetime/basic.md index a3ae52c8..0c577e40 100644 --- a/src/advance/lifetime/basic.md +++ b/src/advance/lifetime/basic.md @@ -287,7 +287,7 @@ error[E0515]: cannot return value referencing local variable `result` // 返回 那遇到这种情况该怎么办?最好的办法就是返回内部字符串的所有权,然后把字符串的所有权转移给调用者: ```rust -fn longest<'a>(_x: &str, _y: &str) -> String { +fn longest(_x: &str, _y: &str) -> String { String::from("really long string") }