From 2eeb2124efcca61a3ba66658e3a39553ca27e7f2 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Mon, 11 Jul 2022 00:21:52 +0800 Subject: [PATCH] fix some typos Signed-off-by: cui fliter --- en/assets/custom3.js | 2 +- en/src/collections/string.md | 2 +- en/src/formatted-output/formatting.md | 2 +- en/src/functional-programing/iterator.md | 2 +- en/src/lifetime/advance.md | 2 +- en/src/lifetime/basic.md | 4 ++-- en/src/lifetime/static.md | 2 +- en/src/newtype-sized.md | 2 +- en/src/result-panic/panic.md | 6 +++--- en/src/type-conversions/others.md | 2 +- en/src/unsafe/inline-asm.md | 2 +- solutions/basic-types/functions.md | 2 +- solutions/functional-programing/closure.md | 2 +- solutions/generics-traits/trait-object.md | 2 +- solutions/result-panic/panic.md | 4 ++-- zh-CN/assets/custom3.js | 2 +- zh-CN/src/result-panic/panic.md | 4 ++-- zh-CN/src/unsafe/inline-asm.md | 2 +- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/en/assets/custom3.js b/en/assets/custom3.js index 3306fa0..47fb24a 100644 --- a/en/assets/custom3.js +++ b/en/assets/custom3.js @@ -110,7 +110,7 @@ var initAll = function () { pagePath = "index" } - // add vistors count + // add visitors count var ele = document.createElement("div"); ele.setAttribute("align","center"); var count = document.createElement("img") diff --git a/en/src/collections/string.md b/en/src/collections/string.md index f00d680..f37c90d 100644 --- a/en/src/collections/string.md +++ b/en/src/collections/string.md @@ -53,7 +53,7 @@ fn main() { 3. 🌟🌟 ```rust,editable -// Question: how many heap allocations are happend here ? +// Question: how many heap allocations are happened here ? // Your answer: fn main() { // Create a String type based on `&str` diff --git a/en/src/formatted-output/formatting.md b/en/src/formatted-output/formatting.md index b68a06e..690dfc8 100644 --- a/en/src/formatted-output/formatting.md +++ b/en/src/formatted-output/formatting.md @@ -135,7 +135,7 @@ fn main() { } ``` -## Capture the enviroments +## Capture the environments 9.🌟🌟🌟 ```rust,editable fn get_person() -> String { diff --git a/en/src/functional-programing/iterator.md b/en/src/functional-programing/iterator.md index 0a49c37..24d9a23 100644 --- a/en/src/functional-programing/iterator.md +++ b/en/src/functional-programing/iterator.md @@ -251,7 +251,7 @@ fn main() { ### Iterator adaptors Methods allowing you to change one iterator into another iterator are known as *iterator adaptors*. You can chain multiple iterator adaptors to perform complex actions in a readable way. -But beacuse **all iterators are lazy**, you have to call one of the consuming adapers to get results from calls to iterator adapters. +But because **all iterators are lazy**, you have to call one of the consuming adapers to get results from calls to iterator adapters. 10γ€πŸŒŸπŸŒŸ ```rust,editable diff --git a/en/src/lifetime/advance.md b/en/src/lifetime/advance.md index 41c9464..a11fb1a 100644 --- a/en/src/lifetime/advance.md +++ b/en/src/lifetime/advance.md @@ -214,7 +214,7 @@ impl<'a> Reader for BufReader<'a> { // 'a is not used in the following methods } -// can be writting as : +// can be writing as : impl Reader for BufReader<'_> { } diff --git a/en/src/lifetime/basic.md b/en/src/lifetime/basic.md index 1c5104e..92398a8 100644 --- a/en/src/lifetime/basic.md +++ b/en/src/lifetime/basic.md @@ -59,11 +59,11 @@ fn main() { ``` ## lifetime annotating -The **borrow checker uses explicit lifetime annotations** to determine how long a referrence should be valid. +The **borrow checker uses explicit lifetime annotations** to determine how long a reference should be valid. But for us users, in most cases, there is no need to annotate the lifetime, because there are several elision rules, before learning these rules, we need to know how to annotate lifetime manually. -#### funtion +#### function Ignoring elision rules, lifetimes in function signatures have a few contraints: - any reference must have an annotated lifetime diff --git a/en/src/lifetime/static.md b/en/src/lifetime/static.md index 7eac7e1..b640b64 100644 --- a/en/src/lifetime/static.md +++ b/en/src/lifetime/static.md @@ -1,5 +1,5 @@ # &'static and T: 'static -`'static` is a reserverd lifetime name, you might have encountered it serveral times: +`'static` is a reserved lifetime name, you might have encountered it serveral times: ```rust // A reference with 'static lifetime: let s: &'static str = "hello world"; diff --git a/en/src/newtype-sized.md b/en/src/newtype-sized.md index 4f0ccb7..479885d 100644 --- a/en/src/newtype-sized.md +++ b/en/src/newtype-sized.md @@ -26,7 +26,7 @@ fn main() { } ``` -2γ€πŸŒŸ Hide the methods of the orginal type +2γ€πŸŒŸ Hide the methods of the original type ```rust,editable /* Make it workd */ struct Meters(u32); diff --git a/en/src/result-panic/panic.md b/en/src/result-panic/panic.md index cd0f6d7..b4ada83 100644 --- a/en/src/result-panic/panic.md +++ b/en/src/result-panic/panic.md @@ -1,7 +1,7 @@ # panic! The simplest error handling mechanism is to use `panic`. It just prints an error message and starts unwinding the stack, finally exit the current thread: -- if panic occured in `main` thread, then the program will be exited. +- if panic occurred in `main` thread, then the program will be exited. - if in spawned thread, then this thread will be terminated, but the program won't @@ -16,13 +16,13 @@ fn drink(beverage: &str) { __ } - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } fn main() { drink(__); - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } ``` diff --git a/en/src/type-conversions/others.md b/en/src/type-conversions/others.md index fcb543c..36b5d31 100644 --- a/en/src/type-conversions/others.md +++ b/en/src/type-conversions/others.md @@ -82,7 +82,7 @@ fn main() { You can find all the examples and exercises of the `Deref` trait [here](https://practice.rs/smart-pointers/deref.html). ### transmute -`std::mem::transmute` is a **unsafe function** can be used to reinterprets the bits of a value of one type as another type. Both of the orginal and the result types must have the same size and neither of them can be invalid. +`std::mem::transmute` is a **unsafe function** can be used to reinterprets the bits of a value of one type as another type. Both of the original and the result types must have the same size and neither of them can be invalid. `transmute` is semantically equivalent to a bitwise move of one type into another. It copies the bits from the source value into the destination value, then forgets the original, seems equivalent to C's `memcpy` under the hood. diff --git a/en/src/unsafe/inline-asm.md b/en/src/unsafe/inline-asm.md index b522ff3..2a007ca 100644 --- a/en/src/unsafe/inline-asm.md +++ b/en/src/unsafe/inline-asm.md @@ -331,7 +331,7 @@ In some cases, fine control is needed over the way a register name is formatted By default the compiler will always choose the name that refers to the full register size (e.g. `rax` on x86-64, `eax` on x86, etc). -This default can be overriden by using modifiers on the template string operands, just like you would with format strings: +This default can be overridden by using modifiers on the template string operands, just like you would with format strings: ```rust use std::arch::asm; diff --git a/solutions/basic-types/functions.md b/solutions/basic-types/functions.md index 02d3f70..da499fc 100644 --- a/solutions/basic-types/functions.md +++ b/solutions/basic-types/functions.md @@ -117,7 +117,7 @@ fn main() { } }; - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } ``` \ No newline at end of file diff --git a/solutions/functional-programing/closure.md b/solutions/functional-programing/closure.md index 86f9e75..50ba556 100644 --- a/solutions/functional-programing/closure.md +++ b/solutions/functional-programing/closure.md @@ -246,7 +246,7 @@ fn main() { ```rust /* Fill in the blank and fix the errror */ -// You can aslo use `impl FnOnce(i32) -> i32` +// You can also use `impl FnOnce(i32) -> i32` fn create_fn() -> impl Fn(i32) -> i32 { let num = 5; diff --git a/solutions/generics-traits/trait-object.md b/solutions/generics-traits/trait-object.md index 5b1a81f..0bdd67e 100644 --- a/solutions/generics-traits/trait-object.md +++ b/solutions/generics-traits/trait-object.md @@ -95,7 +95,7 @@ fn main() { for bird in birds { bird.quack(); - // when duck and swan turns into Bird, they all forgot how to fly, only remeber how to quack + // when duck and swan turns into Bird, they all forgot how to fly, only remember how to quack // so, the below code will cause an error // bird.fly(); } diff --git a/solutions/result-panic/panic.md b/solutions/result-panic/panic.md index a25f86d..eeb2bde 100644 --- a/solutions/result-panic/panic.md +++ b/solutions/result-panic/panic.md @@ -10,13 +10,13 @@ fn drink(beverage: &str) { panic!("drinked, duang.....peng!") } - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } fn main() { drink("lemonade"); - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } ``` diff --git a/zh-CN/assets/custom3.js b/zh-CN/assets/custom3.js index 3306fa0..47fb24a 100644 --- a/zh-CN/assets/custom3.js +++ b/zh-CN/assets/custom3.js @@ -110,7 +110,7 @@ var initAll = function () { pagePath = "index" } - // add vistors count + // add visitors count var ele = document.createElement("div"); ele.setAttribute("align","center"); var count = document.createElement("img") diff --git a/zh-CN/src/result-panic/panic.md b/zh-CN/src/result-panic/panic.md index a9e687d..760faef 100644 --- a/zh-CN/src/result-panic/panic.md +++ b/zh-CN/src/result-panic/panic.md @@ -16,13 +16,13 @@ fn drink(beverage: &str) { __ } - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } fn main() { drink(__); - println!("Excercise Failed if printing out this line!"); + println!("Exercise Failed if printing out this line!"); } ``` diff --git a/zh-CN/src/unsafe/inline-asm.md b/zh-CN/src/unsafe/inline-asm.md index 2946a2c..ebae6ae 100644 --- a/zh-CN/src/unsafe/inline-asm.md +++ b/zh-CN/src/unsafe/inline-asm.md @@ -331,7 +331,7 @@ In some cases, fine control is needed over the way a register name is formatted By default the compiler will always choose the name that refers to the full register size (e.g. `rax` on x86-64, `eax` on x86, etc). -This default can be overriden by using modifiers on the template string operands, just like you would with format strings: +This default can be overridden by using modifiers on the template string operands, just like you would with format strings: ```rust use std::arch::asm;