mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 15:28:40 +08:00
docs: adjust sample code comments
This commit is contained in:
parent
48486b7bb3
commit
0253dc7a4c
@ -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 离开了作用域。但因为它并不拥有引用值的所有权,
|
||||
// 所以什么也不会发生
|
||||
|
Loading…
Reference in New Issue
Block a user