From 16e8f45ab86dda7aeee74cfa89f15d2355ba5c0d Mon Sep 17 00:00:00 2001 From: katopz Date: Tue, 11 Oct 2022 09:43:03 +0700 Subject: [PATCH 1/5] fix: unnecessary space --- en/src/basic-types/char-bool-unit.md | 8 ++++---- en/src/generics-traits/traits.md | 2 +- en/src/ownership/ownership.md | 2 +- zh-CN/src/basic-types/char-bool-unit.md | 8 ++++---- zh-CN/src/generics-traits/traits.md | 2 +- zh-CN/src/ownership/ownership.md | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/en/src/basic-types/char-bool-unit.md b/en/src/basic-types/char-bool-unit.md index 87e0223..cb059d8 100644 --- a/en/src/basic-types/char-bool-unit.md +++ b/en/src/basic-types/char-bool-unit.md @@ -2,7 +2,7 @@ ### Char 1. 🌟 -```rust, editable +```rust,editable // Make it work use std::mem::size_of_val; @@ -18,7 +18,7 @@ fn main() { ``` 2. 🌟 -```rust, editable +```rust,editable // Make it work fn main() { @@ -33,7 +33,7 @@ fn print_char(c : char) { ### Bool 3. 🌟 -```rust, editable +```rust,editable // Make println! work fn main() { @@ -47,7 +47,7 @@ fn main() { ``` 4. 🌟 -```rust, editable +```rust,editable // Make it work fn main() { diff --git a/en/src/generics-traits/traits.md b/en/src/generics-traits/traits.md index 57a861d..938d852 100644 --- a/en/src/generics-traits/traits.md +++ b/en/src/generics-traits/traits.md @@ -335,7 +335,7 @@ The `impl Trait` syntax works for straightforward cases but is actually syntax s When working with generics, the type parameters often must use traits as bounds to stipulate what functionality a type implements. 7. 🌟🌟 -```rust, editable +```rust,editable fn main() { assert_eq!(sum(1, 2), 3); } diff --git a/en/src/ownership/ownership.md b/en/src/ownership/ownership.md index fe94646..01bd390 100644 --- a/en/src/ownership/ownership.md +++ b/en/src/ownership/ownership.md @@ -62,7 +62,7 @@ fn print_str(s: String) { ``` 5. 🌟🌟 -```rust, editable +```rust,editable // Don't use clone ,use copy instead fn main() { let x = (1, 2, (), "hello".to_string()); diff --git a/zh-CN/src/basic-types/char-bool-unit.md b/zh-CN/src/basic-types/char-bool-unit.md index 3c055e8..4bfdcca 100644 --- a/zh-CN/src/basic-types/char-bool-unit.md +++ b/zh-CN/src/basic-types/char-bool-unit.md @@ -2,7 +2,7 @@ ### 字符 1. 🌟 -```rust, editable +```rust,editable // 修改2处 `assert_eq!` 让代码工作 use std::mem::size_of_val; @@ -18,7 +18,7 @@ fn main() { ``` 2. 🌟 -```rust, editable +```rust,editable // 修改一行让代码正常打印 fn main() { let c1 = "中"; @@ -32,7 +32,7 @@ fn print_char(c : char) { ### 布尔 3. 🌟 -```rust, editable +```rust,editable // 使成功打印 fn main() { @@ -46,7 +46,7 @@ fn main() { ``` 4. 🌟 -```rust, editable +```rust,editable fn main() { let f = true; diff --git a/zh-CN/src/generics-traits/traits.md b/zh-CN/src/generics-traits/traits.md index ebe003b..26fb453 100644 --- a/zh-CN/src/generics-traits/traits.md +++ b/zh-CN/src/generics-traits/traits.md @@ -333,7 +333,7 @@ fn main() { 当使用泛型参数时,我们往往需要为该参数指定特定的行为,这种指定方式就是通过特征约束来实现的。 7. 🌟🌟 -```rust, editable +```rust,editable fn main() { assert_eq!(sum(1, 2), 3); } diff --git a/zh-CN/src/ownership/ownership.md b/zh-CN/src/ownership/ownership.md index 3b12d00..9c0b1cf 100644 --- a/zh-CN/src/ownership/ownership.md +++ b/zh-CN/src/ownership/ownership.md @@ -63,7 +63,7 @@ fn print_str(s: String) { ``` 5. 🌟🌟 -```rust, editable +```rust,editable // 不要使用 clone,使用 copy 的方式替代 fn main() { let x = (1, 2, (), "hello".to_string()); From de36f5cfb0f877a754ff6a77fb9581c4206e705b Mon Sep 17 00:00:00 2001 From: katopz Date: Tue, 11 Oct 2022 09:44:22 +0700 Subject: [PATCH 2/5] fix: unnecessary space --- en/src/pattern-match/match-iflet.md | 2 +- solutions/basic-types/numbers.md | 10 +++++----- solutions/collections/Vector.md | 2 +- solutions/ownership/ownership.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/en/src/pattern-match/match-iflet.md b/en/src/pattern-match/match-iflet.md index ea68dfd..89405de 100644 --- a/en/src/pattern-match/match-iflet.md +++ b/en/src/pattern-match/match-iflet.md @@ -204,7 +204,7 @@ fn main() { _ => () } } - ``` +``` > You can find the solutions [here](https://github.com/sunface/rust-by-practice)(under the solutions path), but only use it when you need it \ No newline at end of file diff --git a/solutions/basic-types/numbers.md b/solutions/basic-types/numbers.md index 25b3e5f..f816417 100644 --- a/solutions/basic-types/numbers.md +++ b/solutions/basic-types/numbers.md @@ -50,20 +50,20 @@ fn main() { let v2 = i8::checked_add(119, 8).unwrap(); println!("{},{}",v1,v2); } - ``` +``` 6. - ```rust +```rust fn main() { let v = 1_024 + 0xff + 0o77 + 0b1111_1111; assert!(v == 1597); } - ``` +``` 7. - ```rust +```rust fn main() { let x = 1_000.000_1; // f64 let y: f32 = 0.12; // f32 @@ -76,7 +76,7 @@ fn main() { fn type_of(_: &T) -> String { format!("{}", std::any::type_name::()) } - ``` +``` 8. diff --git a/solutions/collections/Vector.md b/solutions/collections/Vector.md index e2acb24..0442812 100644 --- a/solutions/collections/Vector.md +++ b/solutions/collections/Vector.md @@ -106,7 +106,7 @@ fn main() { println!("Success!") } - ``` +``` 4. diff --git a/solutions/ownership/ownership.md b/solutions/ownership/ownership.md index da93530..3c3f06b 100644 --- a/solutions/ownership/ownership.md +++ b/solutions/ownership/ownership.md @@ -105,7 +105,7 @@ fn print_str(s: String) { fn print_str(s: &String) { println!("{}",s) } - ``` +``` 5. From 81ea842fe791d871efcd8039104e047dc560ebf4 Mon Sep 17 00:00:00 2001 From: katopz Date: Tue, 11 Oct 2022 09:47:49 +0700 Subject: [PATCH 3/5] fix: unnecessary space --- en/src/basic-types/numbers.md | 2 +- en/src/comments-docs.md | 2 +- solutions/functional-programing/closure.md | 6 +++--- zh-CN/src/basic-types/char-bool-unit.md | 4 ++-- zh-CN/src/basic-types/numbers.md | 2 +- zh-CN/src/comments-docs.md | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/en/src/basic-types/numbers.md b/en/src/basic-types/numbers.md index 72d0a28..32a1c95 100644 --- a/en/src/basic-types/numbers.md +++ b/en/src/basic-types/numbers.md @@ -24,7 +24,7 @@ fn main() { 2. 🌟 ```rust,editable -// Fill the blank +// Fill the blank fn main() { let v: u16 = 38_u8 as __; diff --git a/en/src/comments-docs.md b/en/src/comments-docs.md index 3c0894d..c4c408e 100644 --- a/en/src/comments-docs.md +++ b/en/src/comments-docs.md @@ -240,7 +240,7 @@ Besides jump into the standard library, you can also jump to another module in t // in lib.rs mod a { - /// Add four to the given value and return a [`Option`] type + /// Add four to the given value and return a [`Option`] type /// [`crate::MySpecialFormatter`] pub fn add_four(x: i32) -> Option { Some(x + 4) diff --git a/solutions/functional-programing/closure.md b/solutions/functional-programing/closure.md index 50ba556..4a8fea2 100644 --- a/solutions/functional-programing/closure.md +++ b/solutions/functional-programing/closure.md @@ -46,7 +46,7 @@ fn main() { // A non-copy type. let movable = Box::new(3); - // A copy type would copy into the closure leaving the original untouched. + // A copy type would copy into the closure leaving the original untouched. // A non-copy must move and so `movable` immediately moves into // the closure. let consume = || { @@ -55,7 +55,7 @@ fn main() { }; consume(); - // consume(); + // consume(); } fn take(_v: T) { @@ -68,7 +68,7 @@ fn main() { // A non-copy type. let movable = Box::new(3); - // A copy type would copy into the closure leaving the original untouched. + // A copy type would copy into the closure leaving the original untouched. // A non-copy must move and so `movable` immediately moves into // the closure. let consume = || { diff --git a/zh-CN/src/basic-types/char-bool-unit.md b/zh-CN/src/basic-types/char-bool-unit.md index 4bfdcca..08273c6 100644 --- a/zh-CN/src/basic-types/char-bool-unit.md +++ b/zh-CN/src/basic-types/char-bool-unit.md @@ -3,7 +3,7 @@ ### 字符 1. 🌟 ```rust,editable -// 修改2处 `assert_eq!` 让代码工作 +// 修改2处 `assert_eq!` 让代码工作 use std::mem::size_of_val; fn main() { @@ -19,7 +19,7 @@ fn main() { 2. 🌟 ```rust,editable -// 修改一行让代码正常打印 +// 修改一行让代码正常打印 fn main() { let c1 = "中"; print_char(c1); diff --git a/zh-CN/src/basic-types/numbers.md b/zh-CN/src/basic-types/numbers.md index a949f05..b46b7e4 100644 --- a/zh-CN/src/basic-types/numbers.md +++ b/zh-CN/src/basic-types/numbers.md @@ -34,7 +34,7 @@ fn main() { ```rust,editable -// 修改 `assert_eq!` 让代码工作 +// 修改 `assert_eq!` 让代码工作 fn main() { let x = 5; assert_eq!("u32".to_string(), type_of(&x)); diff --git a/zh-CN/src/comments-docs.md b/zh-CN/src/comments-docs.md index 546a270..850a5ed 100644 --- a/zh-CN/src/comments-docs.md +++ b/zh-CN/src/comments-docs.md @@ -205,7 +205,7 @@ pub fn add_three(x: i32) -> Option { // in lib.rs mod a { - /// Add four to the given value and return a [`Option`] type + /// Add four to the given value and return a [`Option`] type /// [`crate::MySpecialFormatter`] pub fn add_four(x: i32) -> Option { Some(x + 4) From 168e004d2841af9a051d7d8566fcdb3e338fd18e Mon Sep 17 00:00:00 2001 From: katopz Date: Tue, 11 Oct 2022 10:11:06 +0700 Subject: [PATCH 4/5] fix: wrong ```` --- en/src/pattern-match/patterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/src/pattern-match/patterns.md b/en/src/pattern-match/patterns.md index 71877b1..0f8cb10 100644 --- a/en/src/pattern-match/patterns.md +++ b/en/src/pattern-match/patterns.md @@ -114,6 +114,6 @@ fn main() { &mut value => value.push_str(" world!") } } -```` +``` > You can find the solutions [here](https://github.com/sunface/rust-by-practice)(under the solutions path), but only use it when you need it From 9b6be7ac83d5e90552803c98e31e4e3eea191db5 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Thu, 13 Oct 2022 09:11:30 +0200 Subject: [PATCH 5/5] no -> not --- en/src/lifetime/static.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/src/lifetime/static.md b/en/src/lifetime/static.md index b640b64..a266ad2 100644 --- a/en/src/lifetime/static.md +++ b/en/src/lifetime/static.md @@ -108,7 +108,7 @@ fn main() { ## T: 'static As a trait bound, it means the type does not contain any non-static references. Eg. the receiver can hold on to the type for as long as they want and it will never become invalid until they drop it. -It's important to understand this means that any owned data always passes a `'static `lifetime bound, but a reference to that owned data generally does no。 +It's important to understand this means that any owned data always passes a `'static `lifetime bound, but a reference to that owned data generally does not. 5、🌟🌟 ```rust,editable @@ -192,4 +192,4 @@ fn print_f(t: &(impl Display + 'static)) { fn print_g(t: &'static String) { println!("{}", t); } -``` \ No newline at end of file +```