mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Merge pull request #441 from blattgold/master-1
slice.md, fixed gramatical error
This commit is contained in:
@ -85,7 +85,7 @@ fn main() {
|
||||
let mut s = String::from("hello world");
|
||||
|
||||
// Here, &s is `&String` type, but `first_word` need a `&str` type.
|
||||
// It works because `&String` can be implicitly converted to `&str. If you want know more, this is called `Deref coercion`.
|
||||
// It works because `&String` can be implicitly converted to `&str. If you want to know more, this is called `Deref coercion`.
|
||||
let word = first_word(&s);
|
||||
|
||||
s.clear(); // error!
|
||||
|
Reference in New Issue
Block a user