From 961ea77981ed7aff346755b9d673f295b2c58860 Mon Sep 17 00:00:00 2001 From: ouyangzecheng Date: Tue, 18 Apr 2023 16:55:22 +0800 Subject: [PATCH] fix: typo --- .../ch04-understanding-ownership/listing-04-09/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listings/ch04-understanding-ownership/listing-04-09/src/main.rs b/listings/ch04-understanding-ownership/listing-04-09/src/main.rs index 46677f7..e7e47a7 100755 --- a/listings/ch04-understanding-ownership/listing-04-09/src/main.rs +++ b/listings/ch04-understanding-ownership/listing-04-09/src/main.rs @@ -16,7 +16,7 @@ fn first_word(s: &str) -> &str { fn main() { let my_string = String::from("hello world"); - // `first_word` 适用于 `String`(的 slice),整体或全部 + // `first_word` 适用于 `String`(的 slice),部分或全部 let word = first_word(&my_string[0..6]); let word = first_word(&my_string[..]); // `first_word` 也适用于 `String` 的引用, @@ -25,7 +25,7 @@ fn main() { let my_string_literal = "hello world"; - // `first_word` 适用于字符串字面值,整体或全部 + // `first_word` 适用于字符串字面值,部分或全部 let word = first_word(&my_string_literal[0..6]); let word = first_word(&my_string_literal[..]);