From 289f3c00d689c8c3e5855ca8eb619d5ab06d53ea Mon Sep 17 00:00:00 2001 From: funkill2 Date: Fri, 19 Apr 2024 04:00:25 +0300 Subject: [PATCH] update original --- .../listing-11-13/tests/integration_test.rs | 4 ++-- rustbook-en/src/ch11-03-test-organization.md | 5 +++-- rustbook-en/src/ch18-02-refutability.md | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs b/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs index e26fa7109..3822d6b97 100644 --- a/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs +++ b/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs @@ -1,6 +1,6 @@ -use adder; +use adder::add_two; #[test] fn it_adds_two() { - assert_eq!(4, adder::add_two(2)); + assert_eq!(4, add_two(2)); } diff --git a/rustbook-en/src/ch11-03-test-organization.md b/rustbook-en/src/ch11-03-test-organization.md index 8aaa9e58a..fb592e909 100644 --- a/rustbook-en/src/ch11-03-test-organization.md +++ b/rustbook-en/src/ch11-03-test-organization.md @@ -118,8 +118,9 @@ Enter the code in Listing 11-13 into the *tests/integration_test.rs* file: `adder` crate Each file in the `tests` directory is a separate crate, so we need to bring our -library into each test crate’s scope. For that reason we add `use adder` at the -top of the code, which we didn’t need in the unit tests. +library into each test crate’s scope. For that reason we add `use +adder::add_two` at the top of the code, which we didn’t need in the unit +tests. We don’t need to annotate any code in *tests/integration_test.rs* with `#[cfg(test)]`. Cargo treats the `tests` directory specially and compiles files diff --git a/rustbook-en/src/ch18-02-refutability.md b/rustbook-en/src/ch18-02-refutability.md index 29ab7ec48..c8ca8b576 100644 --- a/rustbook-en/src/ch18-02-refutability.md +++ b/rustbook-en/src/ch18-02-refutability.md @@ -60,10 +60,10 @@ the code in the curly brackets, giving it a way to continue validly. Listing Listing 18-9: Using `if let` and a block with refutable patterns instead of `let` -We’ve given the code an out! This code is perfectly valid, although it means we -cannot use an irrefutable pattern without receiving a warning. If we give `if -let` a pattern that will always match, such as `x`, as shown in Listing 18-10, -the compiler will give a warning. +We’ve given the code an out! This code is perfectly valid now. However, +if we give `if let` an irrefutable pattern (a pattern that will always +match), such as `x`, as shown in Listing 18-10, the compiler will give a +warning. ```rust {{#rustdoc_include ../listings/ch18-patterns-and-matching/listing-18-10/src/main.rs:here}}