From 4ce2b9f70b4ed4c799dd88fcb15d5918f4bdd475 Mon Sep 17 00:00:00 2001 From: funkill2 Date: Thu, 18 Apr 2024 04:00:19 +0300 Subject: [PATCH] update original --- rustbook-en/Cargo.lock | 20 +++++----- .../hello_macro/hello_macro_derive/Cargo.lock | 36 ++++++++--------- .../hello_macro/hello_macro_derive/src/lib.rs | 1 - .../hello_macro/hello_macro_derive/Cargo.lock | 36 ++++++++--------- .../hello_macro/hello_macro_derive/Cargo.toml | 2 +- .../hello_macro/hello_macro_derive/src/lib.rs | 1 - .../hello_macro/hello_macro_derive/Cargo.lock | 36 ++++++++--------- .../hello_macro/hello_macro_derive/Cargo.toml | 2 +- .../hello_macro/hello_macro_derive/src/lib.rs | 1 - .../pancakes/Cargo.lock | 40 +++++++++---------- .../appendix-04-useful-development-tools.md | 3 +- rustbook-en/src/ch03-05-control-flow.md | 3 ++ rustbook-en/src/ch11-01-writing-tests.md | 8 ++-- .../src/ch13-03-improving-our-io-project.md | 2 +- .../src/ch14-02-publishing-to-crates-io.md | 5 ++- rustbook-en/src/ch17-01-what-is-oo.md | 8 ++-- rustbook-en/src/ch20-01-single-threaded.md | 2 +- 17 files changed, 104 insertions(+), 102 deletions(-) diff --git a/rustbook-en/Cargo.lock b/rustbook-en/Cargo.lock index d0bbf7586..5e9f838fe 100644 --- a/rustbook-en/Cargo.lock +++ b/rustbook-en/Cargo.lock @@ -101,18 +101,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -167,18 +167,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.137" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -193,9 +193,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.96" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock index 9a38c8ac2..6be987b21 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock @@ -1,46 +1,46 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs index 11643a8d6..839ec8359 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs @@ -1,6 +1,5 @@ use proc_macro::TokenStream; use quote::quote; -use syn; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock index 9a38c8ac2..6be987b21 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock @@ -1,46 +1,46 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml index aa076ac48..ed9e917ad 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" proc-macro = true [dependencies] -syn = "1.0" +syn = "2.0" quote = "1.0" diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs index dac6c98f6..ba1215f51 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs @@ -1,6 +1,5 @@ use proc_macro::TokenStream; use quote::quote; -use syn; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock index 9a38c8ac2..6be987b21 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock @@ -1,46 +1,46 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml index aa076ac48..ed9e917ad 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" proc-macro = true [dependencies] -syn = "1.0" +syn = "2.0" quote = "1.0" diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs index 5e0b96c27..654b6bee5 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs @@ -1,6 +1,5 @@ use proc_macro::TokenStream; use quote::quote; -use syn; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock index dee23ecf9..3849f1521 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro" version = "0.1.0" @@ -8,51 +10,49 @@ version = "0.1.0" name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "pancakes" version = "0.1.0" dependencies = [ - "hello_macro 0.1.0", - "hello_macro_derive 0.1.0", + "hello_macro", + "hello_macro_derive", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/src/appendix-04-useful-development-tools.md b/rustbook-en/src/appendix-04-useful-development-tools.md index 40b076153..30249ed57 100644 --- a/rustbook-en/src/appendix-04-useful-development-tools.md +++ b/rustbook-en/src/appendix-04-useful-development-tools.md @@ -95,7 +95,7 @@ fn main() { The `for` loop variable is now named `_i`, and the warning no longer appears. You can also use the `cargo fix` command to transition your code between -different Rust editions. Editions are covered in Appendix E. +different Rust editions. Editions are covered in [Appendix E][editions]. ### More Lints with Clippy @@ -178,3 +178,4 @@ particular IDE. Your IDE will gain abilities such as autocompletion, jump to definition, and inline errors. [rust-analyzer]: https://rust-analyzer.github.io +[editions]: appendix-05-editions.md diff --git a/rustbook-en/src/ch03-05-control-flow.md b/rustbook-en/src/ch03-05-control-flow.md index 34b8372f3..ac416660d 100644 --- a/rustbook-en/src/ch03-05-control-flow.md +++ b/rustbook-en/src/ch03-05-control-flow.md @@ -250,6 +250,9 @@ and then check whether the `counter` is equal to `10`. When it is, we use the semicolon to end the statement that assigns the value to `result`. Finally, we print the value in `result`, which in this case is `20`. +You can also `return` from inside a loop. While `break` only exits the current +loop, `return` always exits the current function. + #### Loop Labels to Disambiguate Between Multiple Loops If you have loops within loops, `break` and `continue` apply to the innermost diff --git a/rustbook-en/src/ch11-01-writing-tests.md b/rustbook-en/src/ch11-01-writing-tests.md index aaac8e806..f1295931f 100644 --- a/rustbook-en/src/ch11-01-writing-tests.md +++ b/rustbook-en/src/ch11-01-writing-tests.md @@ -497,10 +497,10 @@ This time when we run the `should_panic` test, it will fail: ``` The failure message indicates that this test did indeed panic as we expected, -but the panic message did not include the expected string `'Guess value must be -less than or equal to 100'`. The panic message that we did get in this case was -`Guess value must be greater than or equal to 1, got 200.` Now we can start -figuring out where our bug is! +but the panic message did not include the expected string `less than or equal +to 100`. The panic message that we did get in this case was `Guess value must +be greater than or equal to 1, got 200.` Now we can start figuring out where +our bug is! ### Using `Result` in Tests diff --git a/rustbook-en/src/ch13-03-improving-our-io-project.md b/rustbook-en/src/ch13-03-improving-our-io-project.md index 42a5be89d..e4deec562 100644 --- a/rustbook-en/src/ch13-03-improving-our-io-project.md +++ b/rustbook-en/src/ch13-03-improving-our-io-project.md @@ -90,7 +90,7 @@ We’ve updated the signature of the `Config::build` function so the parameter `args` has a generic type with the trait bounds `impl Iterator` instead of `&[String]`. This usage of the `impl Trait` syntax we discussed in the [“Traits as Parameters”][impl-trait] section of Chapter 10 -means that `args` can be any type that implements the `Iterator` type and +means that `args` can be any type that implements the `Iterator` trait and returns `String` items. Because we’re taking ownership of `args` and we’ll be mutating `args` by diff --git a/rustbook-en/src/ch14-02-publishing-to-crates-io.md b/rustbook-en/src/ch14-02-publishing-to-crates-io.md index c5b1ac7fc..d4d33babc 100644 --- a/rustbook-en/src/ch14-02-publishing-to-crates-io.md +++ b/rustbook-en/src/ch14-02-publishing-to-crates-io.md @@ -273,10 +273,11 @@ in via a GitHub account. (The GitHub account is currently a requirement, but the site might support other ways of creating an account in the future.) Once you’re logged in, visit your account settings at [https://crates.io/me/](https://crates.io/me/) and retrieve your -API key. Then run the `cargo login` command with your API key, like this: +API key. Then run the `cargo login` command and paste your API key when prompted, like this: ```console -$ cargo login abcdefghijklmnopqrstuvwxyz012345 +$ cargo login +abcdefghijklmnopqrstuvwxyz012345 ``` This command will inform Cargo of your API token and store it locally in diff --git a/rustbook-en/src/ch17-01-what-is-oo.md b/rustbook-en/src/ch17-01-what-is-oo.md index a47afebd9..4a11b7cc0 100644 --- a/rustbook-en/src/ch17-01-what-is-oo.md +++ b/rustbook-en/src/ch17-01-what-is-oo.md @@ -86,10 +86,10 @@ Because we’ve encapsulated the implementation details of the struct in the future. For instance, we could use a `HashSet` instead of a `Vec` for the `list` field. As long as the signatures of the `add`, `remove`, and `average` public methods stay the same, code using -`AveragedCollection` wouldn’t need to change. If we made `list` public instead, -this wouldn’t necessarily be the case: `HashSet` and `Vec` have -different methods for adding and removing items, so the external code would -likely have to change if it were modifying `list` directly. +`AveragedCollection` wouldn’t need to change in order to compile. If we made +`list` public instead, this wouldn’t necessarily be the case: `HashSet` and +`Vec` have different methods for adding and removing items, so the external +code would likely have to change if it were modifying `list` directly. If encapsulation is a required aspect for a language to be considered object-oriented, then Rust meets that requirement. The option to use `pub` or diff --git a/rustbook-en/src/ch20-01-single-threaded.md b/rustbook-en/src/ch20-01-single-threaded.md index 993239a98..b980856fd 100644 --- a/rustbook-en/src/ch20-01-single-threaded.md +++ b/rustbook-en/src/ch20-01-single-threaded.md @@ -448,7 +448,7 @@ uses the `status_line` and `filename` variables. This makes it easier to see the difference between the two cases, and it means we have only one place to update the code if we want to change how the file reading and response writing work. The behavior of the code in Listing 20-9 will be the same as that in -Listing 20-8. +Listing 20-7. Awesome! We now have a simple web server in approximately 40 lines of Rust code that responds to one request with a page of content and responds to all other