diff --git a/en/src/compound-types/string.md b/en/src/compound-types/string.md index f058271..627ce5e 100644 --- a/en/src/compound-types/string.md +++ b/en/src/compound-types/string.md @@ -22,7 +22,7 @@ fn main() { // Fix the error with at least two solutions fn main() { - let s: Box = "hello, world".into(); + let s: Box = "hello, world".into(); greetings(s) } @@ -54,7 +54,7 @@ fn main() { // Fix all errors without adding newline fn main() { - let s = String::from("hello"); + let s = String::from("hello"); s.push(','); s.push(" world"); s += "!".to_string(); @@ -102,7 +102,7 @@ Opsite to the seldom using of `str`, `&str` and `String` are used everywhere! // Fix error with at least two solutions fn main() { - let s = "hello, world"; + let s = "hello, world"; greetings(s) } @@ -117,7 +117,7 @@ fn greetings(s: String) { // Use two approaches to fix the error and without adding a new line fn main() { - let s = "hello, world".to_string(); + let s = "hello, world".to_string(); let s1: &str = s; println!("Success!"); diff --git a/en/src/functional-programing/cloure.md b/en/src/functional-programing/cloure.md index 7546057..25b77ac 100644 --- a/en/src/functional-programing/cloure.md +++ b/en/src/functional-programing/cloure.md @@ -173,7 +173,7 @@ fn main() { fn main() { let mut s = String::new(); - let update_string = |str| s.push_str(str); + let update_string = |str| s.push_str(str); exec(update_string); @@ -260,7 +260,7 @@ move closures may still implement `Fn` or `FnMut`, even though they capture vari fn main() { let s = String::new(); - let update_string = move || println!("{}",s); + let update_string = move || println!("{}",s); exec(update_string); } @@ -275,7 +275,7 @@ The following code also has no error: fn main() { let s = String::new(); - let update_string = move || println!("{}",s); + let update_string = move || println!("{}",s); exec(update_string); } diff --git a/en/src/variables.md b/en/src/variables.md index 6e70f14..7e092f0 100644 --- a/en/src/variables.md +++ b/en/src/variables.md @@ -19,7 +19,7 @@ fn main() { // Fill the blanks in the code to make it compile fn main() { - let __ = 1; + let __ = 1; __ += 2; assert_eq!(x, 3); @@ -73,7 +73,7 @@ fn main() { assert_eq!(x, 12); - let x = 42; + let x = 42; println!("{}", x); // Prints "42". } ``` diff --git a/solutions/compound-types/string.md b/solutions/compound-types/string.md index c9edee0..046083f 100644 --- a/solutions/compound-types/string.md +++ b/solutions/compound-types/string.md @@ -10,7 +10,7 @@ fn main() { ```rust fn main() { - let s: Box = "hello, world".into(); + let s: Box = "hello, world".into(); greetings(&s) } @@ -46,7 +46,7 @@ fn main() { ```rust fn main() { - let mut s = String::from("hello"); + let mut s = String::from("hello"); s.push(','); s.push_str(" world"); s += "!"; @@ -83,7 +83,7 @@ fn main() { ```rust fn main() { - let s = "hello, world".to_string(); + let s = "hello, world".to_string(); greetings(s) } @@ -114,7 +114,7 @@ fn main() { ```rust fn main() { - let s = "hello, world"; + let s = "hello, world"; let s1: &str = s; } ``` diff --git a/solutions/functional-programing/closure.md b/solutions/functional-programing/closure.md index 9bc33a8..86f9e75 100644 --- a/solutions/functional-programing/closure.md +++ b/solutions/functional-programing/closure.md @@ -136,7 +136,7 @@ fn main() { fn main() { let mut s = String::new(); - let update_string = |str| s.push_str(str); + let update_string = |str| s.push_str(str); exec(update_string); diff --git a/zh-CN/src/compound-types/string.md b/zh-CN/src/compound-types/string.md index e668464..48cfc1c 100644 --- a/zh-CN/src/compound-types/string.md +++ b/zh-CN/src/compound-types/string.md @@ -20,7 +20,7 @@ fn main() { // 使用至少两种方法来修复错误 fn main() { - let s: Box = "hello, world".into(); + let s: Box = "hello, world".into(); greetings(s) } @@ -50,7 +50,7 @@ fn main() { // 修复所有错误,并且不要新增代码行 fn main() { - let s = String::from("hello"); + let s = String::from("hello"); s.push(','); s.push(" world"); s += "!".to_string(); @@ -98,7 +98,7 @@ fn main() { // 使用至少两种方法来修复错误 fn main() { - let s = "hello, world"; + let s = "hello, world"; greetings(s) } @@ -113,7 +113,7 @@ fn greetings(s: String) { // 使用两种方法来解决错误,不要新增代码行 fn main() { - let s = "hello, world".to_string(); + let s = "hello, world".to_string(); let s1: &str = s; } ``` diff --git a/zh-CN/src/variables.md b/zh-CN/src/variables.md index 0febb14..12e1b28 100644 --- a/zh-CN/src/variables.md +++ b/zh-CN/src/variables.md @@ -18,7 +18,7 @@ fn main() { // 完形填空,让代码编译 fn main() { - let __ = 1; + let __ = 1; __ += 2; println!("x = {}", x); @@ -69,7 +69,7 @@ fn main() { assert_eq!(x, 12); - let x = 42; + let x = 42; println!("{}", x); // 输出 "42". } ```