Skip to content

Commit

Permalink
[BOT] Updating 87a320f content
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 14, 2024
1 parent 87a320f commit 0653d5c
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn main() {
let hello = String::from("السلام عليكم");
let hello = String::from("Dobrý den");
let hello = String::from("Hello");
let hello = String::from("שָׁלוֹם");
let hello = String::from("שלום");
let hello = String::from("नमस्ते");
let hello = String::from("こんにちは");
let hello = String::from("안녕하세요");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// ANCHOR: here
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn exploration() {
assert_eq!(2 + 2, 4);
let result = add(2, 2);
assert_eq!(result, 4);
}

#[test]
fn another() {
panic!("Make this test fail");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn exploration() {
assert_eq!(2 + 2, 4);
let result = add(2, 2);
assert_eq!(result, 4);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];

for _ in 0..=10 {
for _ in 0..10 {
let counter = Arc::clone(&counter);
let handle = thread::spawn(move || {
let mut num = counter.lock().unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ edition = "2021"
proc-macro = true

[dependencies]
syn = "1.0"
syn = "2.0"
quote = "1.0"
2 changes: 1 addition & 1 deletion rustbook-en/src/ch00-00-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Rust also brings contemporary developer tools to the systems programming world:
ecosystem.
* The Rustfmt formatting tool ensures a consistent coding style across
developers.
* The Rust Language Server powers Integrated Development Environment (IDE)
* The rust-analyzer powers Integrated Development Environment (IDE)
integration for code completion and inline error messages.

By using these and other tools in the Rust ecosystem, developers can be
Expand Down
15 changes: 4 additions & 11 deletions rustbook-en/src/ch01-01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,9 @@ the `build-essential` package.

On Windows, go to [https://www.rust-lang.org/tools/install][install] and follow
the instructions for installing Rust. At some point in the installation, you’ll
receive a message explaining that you’ll also need the MSVC build tools for
Visual Studio 2013 or later.

To acquire the build tools, you’ll need to install [Visual Studio
2022][visualstudio]. When asked which workloads to install, include:

* “Desktop Development with C++”
* The Windows 10 or 11 SDK
* The English language pack component, along with any other language pack of
your choosing
be prompted to install Visual Studio. This provides a linker and the native
libraries needed to compile programs. If you need more help with this step, see
[https://rust-lang.github.io/rustup/installation/windows-msvc.html][msvc]

The rest of this book uses commands that work in both *cmd.exe* and PowerShell.
If there are specific differences, we’ll explain which to use.
Expand Down Expand Up @@ -143,5 +136,5 @@ sure what it does or how to use it, use the application programming interface

[otherinstall]: https://forge.rust-lang.org/infra/other-installation-methods.html
[install]: https://www.rust-lang.org/tools/install
[visualstudio]: https://visualstudio.microsoft.com/downloads/
[msvc]: https://rust-lang.github.io/rustup/installation/windows-msvc.html
[community]: https://www.rust-lang.org/community
4 changes: 2 additions & 2 deletions rustbook-en/src/ch02-00-guessing-game-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ checked into source control with the rest of the code in your project.
When you *do* want to update a crate, Cargo provides the command `update`,
which will ignore the *Cargo.lock* file and figure out all the latest versions
that fit your specifications in *Cargo.toml*. Cargo will then write those
versions to the *Cargo.lock* file. Otherwise, by default, Cargo will only look
for versions greater than 0.8.5 and less than 0.9.0. If the `rand` crate has
versions to the *Cargo.lock* file. In this case, Cargo will only look for
versions greater than 0.8.5 and less than 0.9.0. If the `rand` crate has
released the two new versions 0.8.6 and 0.9.0, you would see the following if
you ran `cargo update`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ from a new scope with `pub use`</span>

Before this change, external code would have to call the `add_to_waitlist`
function by using the path
`restaurant::front_of_house::hosting::add_to_waitlist()`. Now that this `pub
`restaurant::front_of_house::hosting::add_to_waitlist()`, which also would have
required the `front_of_house` module to be marked as `pub`. Now that this `pub
use` has re-exported the `hosting` module from the root module, external code
can now use the path `restaurant::hosting::add_to_waitlist()` instead.

Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch10-03-lifetime-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Here, `x` has the lifetime `'b`, which in this case is larger than `'a`. This
means `r` can reference `x` because Rust knows that the reference in `r` will
always be valid while `x` is valid.

Now that you know where the lifetimes of references are and how Rust analyzes
Now that you know what the lifetimes of references are and how Rust analyzes
lifetimes to ensure references will always be valid, let’s explore generic
lifetimes of parameters and return values in the context of functions.

Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch11-01-writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ cd ../../..
<span class="caption">Listing 11-1: The test module and function generated
automatically by `cargo new`</span>

For now, let’s ignore the top two lines and focus on the function. Note the
For now, let’s focus solely on the `it_works()` function. Note the
`#[test]` annotation: this attribute indicates this is a test function, so the
test runner knows to treat this function as a test. We might also have non-test
functions in the `tests` module to help set up common scenarios or perform
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch11-03-test-organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Note that the `internal_adder` function is not marked as `pub`. Tests are just
Rust code, and the `tests` module is just another module. As we discussed in
the [“Paths for Referring to an Item in the Module Tree”][paths]<!-- ignore -->
section, items in child modules can use the items in their ancestor modules. In
this test, we bring all of the `test` module’s parent’s items into scope with
this test, we bring all of the `tests` module’s parent’s items into scope with
`use super::*`, and then the test can call `internal_adder`. If you don’t think
private functions should be tested, there’s nothing in Rust that will compel
you to do so.
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch16-02-message-passing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ producer for now, but we’ll add multiple producers when we get this example
working.

The `mpsc::channel` function returns a tuple, the first element of which is the
sending end--the transmitter--and the second element is the receiving end--the
sending endthe transmitterand the second element is the receiving endthe
receiver. The abbreviations `tx` and `rx` are traditionally used in many fields
for *transmitter* and *receiver* respectively, so we name our variables as such
to indicate each end. We’re using a `let` statement with a pattern that
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch16-03-shared-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ We hinted that this example wouldn’t compile. Now let’s find out why!

The error message states that the `counter` value was moved in the previous
iteration of the loop. Rust is telling us that we can’t move the ownership
of lock `counter` into multiple threads. Let’s fix the compiler error with a
of `counter` into multiple threads. Let’s fix the compiler error with a
multiple-ownership method we discussed in Chapter 15.

#### Multiple Ownership with Multiple Threads
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch19-03-advanced-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ that holds an instance of `Vec<T>`; then we can implement `Display` on

The implementation of `Display` uses `self.0` to access the inner `Vec<T>`,
because `Wrapper` is a tuple struct and `Vec<T>` is the item at index 0 in the
tuple. Then we can use the functionality of the `Display` type on `Wrapper`.
tuple. Then we can use the functionality of the `Display` trait on `Wrapper`.

The downside of using this technique is that `Wrapper` is a new type, so it
doesn’t have the methods of the value it’s holding. We would have to implement
Expand Down
2 changes: 1 addition & 1 deletion rustbook-en/src/ch19-06-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,6 @@ and do one more project!
[tlborm]: https://veykril.github.io/tlborm/
[`syn`]: https://crates.io/crates/syn
[`quote`]: https://crates.io/crates/quote
[syn-docs]: https://docs.rs/syn/1.0/syn/struct.DeriveInput.html
[syn-docs]: https://docs.rs/syn/2.0/syn/struct.DeriveInput.html
[quote-docs]: https://docs.rs/quote
[decl]: #declarative-macros-with-macro_rules-for-general-metaprogramming
2 changes: 1 addition & 1 deletion rustbook-en/src/title-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ to install or update Rust.

The HTML format is available online at
[https://doc.rust-lang.org/stable/book/](https://doc.rust-lang.org/stable/book/)
and offline with installations of Rust made with `rustup`; run `rustup docs
and offline with installations of Rust made with `rustup`; run `rustup doc
--book` to open.

Several community [translations] are also available.
Expand Down

0 comments on commit 0653d5c

Please sign in to comment.