From f1fb9a558fb5429edc2f851a64281097999a1b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B5=A9=E6=89=AC=E7=A9=BFJK?= <3119369616@qq.com> Date: Mon, 6 Jan 2025 17:12:13 +0800 Subject: [PATCH] Update lifetime.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此处没有用到生命周期标注符,可以去掉了 --- src/basic/lifetime.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/lifetime.md b/src/basic/lifetime.md index d499dac0..5917b14d 100644 --- a/src/basic/lifetime.md +++ b/src/basic/lifetime.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") }