From f9a1d427b24909705e6954a4b7a588dbd2b01450 Mon Sep 17 00:00:00 2001 From: LukeMathWalker <20745048+LukeMathWalker@users.noreply.github.com> Date: Wed, 7 Aug 2024 15:39:35 +0200 Subject: [PATCH] Adjust margins for paperback version. Ensure nothing breaches the right margin. --- book/book.toml | 2 +- book/src/01_intro/00_welcome.md | 7 +++---- book/src/01_intro/01_syntax.md | 2 +- book/src/03_ticket_v1/06_ownership.md | 4 ++-- book/src/04_traits/04_derive.md | 3 ++- book/src/04_traits/05_trait_bounds.md | 3 ++- book/src/07_threads/11_locks.md | 10 ++++++---- book/src/08_futures/04_future.md | 3 ++- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/book/book.toml b/book/book.toml index 3580ba5..e1abf43 100644 --- a/book/book.toml +++ b/book/book.toml @@ -61,7 +61,7 @@ monofontfallback = [ urlstyle = "rm" documentclass = "book" fontsize = "11pt" -geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.4cm,right=2.4cm" +geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.8cm,right=2.5cm" header-includes = [ # Reduce font size of code blocks "\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}", diff --git a/book/src/01_intro/00_welcome.md b/book/src/01_intro/00_welcome.md index 285f686..ddaaff3 100644 --- a/book/src/01_intro/00_welcome.md +++ b/book/src/01_intro/00_welcome.md @@ -34,8 +34,8 @@ also find solutions to all exercises in the ## Formats -You can browse the course material in the browser, at [rust-exercises.com/100-exercises/](https://rust-exercises.com/100-exercises/).\ -You can also [download the course material as a PDF file](https://rust-exercises.com/100-exercises-to-learn-rust.pdf), for offline reading. +You can go through the course material [in the browser](https://rust-exercises.com/100-exercises/).\ +You can also [download it as a PDF file](https://rust-exercises.com/100-exercises-to-learn-rust.pdf), for offline reading. ## Structure @@ -51,8 +51,7 @@ Before starting the course, make sure to clone the repository to your local mach # If you have an SSH key set up with GitHub git clone git@github.com:mainmatter/100-exercises-to-learn-rust.git # Otherwise, use the HTTPS URL: -# -# git clone https://github.com/mainmatter/100-exercises-to-learn-rust.git +# https://github.com/mainmatter/100-exercises-to-learn-rust.git ``` We also recommend you work on a branch, so you can easily track your progress and pull diff --git a/book/src/01_intro/01_syntax.md b/book/src/01_intro/01_syntax.md index 746a22d..ae75733 100644 --- a/book/src/01_intro/01_syntax.md +++ b/book/src/01_intro/01_syntax.md @@ -32,7 +32,7 @@ The function's body is enclosed in curly braces `{}`. In previous exercise, you saw the `greeting` function: ```rust -// `fn` ( ) -> { } +// `fn` ( ) -> { } fn greeting() -> &'static str { // TODO: fix me 👇 "I'm ready to __!" diff --git a/book/src/03_ticket_v1/06_ownership.md b/book/src/03_ticket_v1/06_ownership.md index f0cb5cf..df9baff 100644 --- a/book/src/03_ticket_v1/06_ownership.md +++ b/book/src/03_ticket_v1/06_ownership.md @@ -97,8 +97,8 @@ Ownership can be transferred. If you own a value, for example, you can transfer ownership to another variable: ```rust -let a = "hello, world".to_string(); // <--- `a` is the owner of the String -let b = a; // <--- `b` is now the owner of the String +let a = "hello, world".to_string(); // <- `a` is the owner of the String +let b = a; // <- `b` is now the owner of the String ``` Rust's ownership system is baked into the type system: each function has to declare in its signature diff --git a/book/src/04_traits/04_derive.md b/book/src/04_traits/04_derive.md index 0078d19..a24c332 100644 --- a/book/src/04_traits/04_derive.md +++ b/book/src/04_traits/04_derive.md @@ -89,7 +89,8 @@ although a bit more cumbersome to read: impl ::core::cmp::PartialEq for Ticket { #[inline] fn eq(&self, other: &Ticket) -> bool { - self.title == other.title && self.description == other.description + self.title == other.title + && self.description == other.description && self.status == other.status } } diff --git a/book/src/04_traits/05_trait_bounds.md b/book/src/04_traits/05_trait_bounds.md index 53f92e8..06eb34c 100644 --- a/book/src/04_traits/05_trait_bounds.md +++ b/book/src/04_traits/05_trait_bounds.md @@ -99,7 +99,8 @@ error[E0599]: no method named `is_even` found for type parameter `T` --> src/lib.rs:2:10 | 1 | fn print_if_even(n: T) { - | - method `is_even` not found for this type parameter + | - method `is_even` not found + | for this type parameter 2 | if n.is_even() { | ^^^^^^^ method not found in `T` diff --git a/book/src/07_threads/11_locks.md b/book/src/07_threads/11_locks.md index 3833bc1..bfac1f4 100644 --- a/book/src/07_threads/11_locks.md +++ b/book/src/07_threads/11_locks.md @@ -111,7 +111,8 @@ fn main() { The compiler is not happy with this code: ```text -error[E0277]: `MutexGuard<'_, i32>` cannot be sent between threads safely +error[E0277]: `MutexGuard<'_, i32>` cannot be sent between + threads safely --> src/main.rs:10:7 | 10 | spawn(move || { @@ -122,9 +123,10 @@ error[E0277]: `MutexGuard<'_, i32>` cannot be sent between threads safely 12 | | }); | |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `MutexGuard<'_, i32>`, - which is required by `{closure@src/main.rs:10:7: 10:14}: Send` - = note: required for `std::sync::mpsc::Receiver>` + = help: the trait `Send` is not implemented for + `MutexGuard<'_, i32>`, which is required by + `{closure@src/main.rs:10:7: 10:14}: Send` + = note: required for `Receiver>` to implement `Send` note: required because it's used within this closure ``` diff --git a/book/src/08_futures/04_future.md b/book/src/08_futures/04_future.md index 0e0a012..987147e 100644 --- a/book/src/08_futures/04_future.md +++ b/book/src/08_futures/04_future.md @@ -47,7 +47,8 @@ The compiler will reject this code: error: future cannot be sent between threads safely | 5 | tokio::spawn(example()); - | ^^^^^^^^^ future returned by `example` is not `Send` + | ^^^^^^^^^ + | future returned by `example` is not `Send` | note: future is not `Send` as this value is used across an await |