diff --git a/en/deploy.sh b/en/deploy.sh index 880ab5c..69b6eeb 100755 --- a/en/deploy.sh +++ b/en/deploy.sh @@ -16,8 +16,4 @@ git branch -M gh-pages git remote add origin https://github.com/sunface/rust-by-practice ## push to github pages -git push -u -f origin gh-pages - -## deploy zh-CN -cd ../../zh-CN -./deploy \ No newline at end of file +git push -u -f origin gh-pages \ No newline at end of file diff --git a/en/src/compound-types/slice.md b/en/src/compound-types/slice.md index 23aa344..152e61c 100644 --- a/en/src/compound-types/slice.md +++ b/en/src/compound-types/slice.md @@ -84,15 +84,15 @@ fn main() { fn main() { let mut s = String::from("hello world"); - // Here, &s is `&String` type, but `first_word` need a `&str` type. + // Here, &s is `&String` type, but `first_letter` needs a `&str` type. // 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); + let letter = first_letter(&s); s.clear(); // error! - println!("the first word is: {}", word); + println!("the first letter is: {}", letter); } -fn first_word(s: &str) -> &str { +fn first_letter(s: &str) -> &str { &s[..1] } ``` diff --git a/en/src/ownership/ownership.md b/en/src/ownership/ownership.md index e0054f9..eb8568c 100644 --- a/en/src/ownership/ownership.md +++ b/en/src/ownership/ownership.md @@ -5,9 +5,9 @@ fn main() { // Use as many approaches as you can to make it work - let x = String::from("hello, world"); + let x = String::from("Hello world"); let y = x; - println!("{},{}",x,y); + println!("{}, {}",x, y); } ``` @@ -15,7 +15,7 @@ fn main() { ```rust,editable // Don't modify code in main! fn main() { - let s1 = String::from("hello, world"); + let s1 = String::from("Hello world"); let s2 = take_ownership(s1); println!("{}", s2); @@ -38,7 +38,7 @@ fn main() { // Only modify the code below! fn give_ownership() -> String { - let s = String::from("hello, world"); + let s = String::from("Hello world"); // Convert String to Vec let _s = s.into_bytes(); s @@ -47,9 +47,9 @@ fn give_ownership() -> String { 4. 🌟🌟 ```rust,editable -// Fix the error without removing code line +// Fix the error without removing any code fn main() { - let s = String::from("hello, world"); + let s = String::from("Hello World"); print_str(s); @@ -77,13 +77,13 @@ Mutability can be changed when ownership is transferred. 6. 🌟 ```rust,editable +// make the necessary variable mutable fn main() { - let s = String::from("hello, "); + let s = String::from("Hello "); - // Modify this line only ! let s1 = s; - s1.push_str("world"); + s1.push_str("World!"); println!("Success!"); } @@ -95,7 +95,7 @@ fn main() { fn main() { let x = Box::new(5); - let ... // Implement this line, dont change other lines! + let ... // update this line, don't change other lines! *y = 4; @@ -167,4 +167,4 @@ fn main() { ``` -> You can find the solutions [here](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/ownership.md)(under the solutions path), but only use it when you need it \ No newline at end of file +> You can find the solutions [here](https://github.com/sunface/rust-by-practice/blob/master/solutions/ownership/ownership.md)(under the solutions path), but only use it when you need it diff --git a/en/theme/index.hbs b/en/theme/index.hbs index 3fc804d..ac76bff 100644 --- a/en/theme/index.hbs +++ b/en/theme/index.hbs @@ -1,11 +1,11 @@ - + {{ title }} {{#if is_print }} - + {{/if}} {{#if base_url}} @@ -15,10 +15,9 @@ {{> head}} - - + {{#if favicon_svg}} @@ -51,25 +50,27 @@ {{#if mathjax_support}} - + {{/if}} - - + +
- - - + + - + + +
{{> header}} -