docs: adjust sample code comments

This commit is contained in:
YangFong 2022-03-07 19:00:10 +08:00
parent 48486b7bb3
commit 0253dc7a4c
3 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ fn main() {
}
// ANCHOR: here
fn calculate_length(s: &String) -> usize { // s is a reference to a String
fn calculate_length(s: &String) -> usize { // s 是对 String 的引用
s.len()
} // 这里s 离开了作用域。但因为它并不拥有引用值的所有权,
// 所以什么也不会发生