Merge pull request #715 from oyzecheng/fix/typo

fix: typo
pull/717/head
KaiserY 2 years ago committed by GitHub
commit 69622d9261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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[..]);

Loading…
Cancel
Save