Skip to content

Commit

Permalink
Fixes made in final layout check
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Jun 26, 2019
1 parent 6c0d834 commit cc6a1ef
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ removing some of the modules and functions. We’ll show two ways to call the
the crate root. The `eat_at_restaurant` function is part of our library crate’s
public API, so we mark it with the `pub` keyword. In the [”Exposing Paths with
the `pub` Keyword”][pub]<!-- ignore --> section, we’ll go into more detail
about `pub`.

Note that this example won’t compile just yet; we’ll explain why in a bit.
about `pub`. Note that this example won’t compile just yet; we’ll explain why
in a bit.

<span class="filename">Filename: src/lib.rs</span>

Expand Down
6 changes: 3 additions & 3 deletions src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ crate.

If we’re using multiple items defined in the same package or same module,
listing each item on its own line can take up a lot of vertical space in our
files. For example, these two `use` statements we had in Listing 2-4 in the
Guessing Game bring items from `std` into scope:
files. For example, these two `use` statements we had in the Guessing Game in
Listing 2-4 bring items from `std` into scope:

<span class="filename">Filename: src/main.rs</span>

```rust
use std::cmp::Ordering;
use std::io;
use std::cmp::Ordering;
// ---snip---
```

Expand Down
2 changes: 1 addition & 1 deletion src/ch09-02-recoverable-errors-with-result.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ fn main() -> Result<(), Box<dyn Error>> {
}
```

The `Box<dyn Error>` type is called a *trait object*, which we’ll talk about in
The `Box<dyn Error>` type is called a trait object, which we’ll talk about in
the [“Using Trait Objects that Allow for Values of Different
Types”][trait-objects]<!-- ignore --> section in Chapter 17. For now, you can
read `Box<dyn Error>` to mean “any kind of error.” Using `?` in a `main`
Expand Down
13 changes: 7 additions & 6 deletions src/ch11-01-writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ larger rectangle can indeed hold a smaller rectangle</span>

Note that we’ve added a new line inside the `tests` module: `use super::*;`.
The `tests` module is a regular module that follows the usual visibility rules
we covered in Chapter 7 in the [“Modules as the Privacy
Boundary”][modules-as-privacy-boundary]<!-- ignore --> section. Because the
`tests` module is an inner module, we need to bring the code under test in the
outer module into the scope of the inner module. We use a glob here so anything
we define in the outer module is available to this `tests` module.
we covered in Chapter 7 in the [“Paths for Referring to an Item in the Module
Tree”][paths-for-referring-to-an-item-in-the-module-tree]<!-- ignore -->
section. Because the `tests` module is an inner module, we need to bring the
code under test in the outer module into the scope of the inner module. We use
a glob here so anything we define in the outer module is available to this
`tests` module.

We’ve named our test `larger_can_hold_smaller`, and we’ve created the two
`Rectangle` instances that we need. Then we called the `assert!` macro and
Expand Down Expand Up @@ -849,4 +850,4 @@ ch08-02-strings.html#concatenation-with-the--operator-or-the-format-macro
ch11-02-running-tests.html#controlling-how-tests-are-run
[derivable-traits]: appendix-03-derivable-traits.html
[doc-comments]: ch14-02-publishing-to-crates-io.html#documentation-comments-as-tests
[modules-as-privacy-boundary]: ch07-02-defining-modules-to-control-scope-and-privacy.html
[paths-for-referring-to-an-item-in-the-module-tree]: ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html
2 changes: 1 addition & 1 deletion src/ch11-03-test-organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ fn it_adds_two() {
```

Note that the `mod common;` declaration is the same as the module declaration
we demonstrated in Listing 7-25. Then in the test function, we can call the
we demonstrated in Listing 7-21. Then in the test function, we can call the
`common::setup()` function.

#### Integration Tests for Binary Crates
Expand Down
17 changes: 8 additions & 9 deletions src/title-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

*by Steve Klabnik and Carol Nichols, with contributions from the Rust Community*

Welcome to *The Rust Programming Language* book! This version of the text assumes
you’re using Rust 1.31.0 or later with `edition="2018"` in *Cargo.toml* of
all projects to use Rust 2018 Edition idioms. See the [“Installation” section
of Chapter 1][install]<!-- ignore --> to install or update Rust, and see the
new [Appendix E][editions]<!-- ignore --> for information on what editions of
Rust are.
This version of the text assumes you’re using Rust 1.31.0 or later with
`edition="2018"` in *Cargo.toml* of all projects to use Rust 2018 Edition
idioms. See the [“Installation” section of Chapter 1][install]<!-- ignore -->
to install or update Rust, and see the new [Appendix E][editions]<!-- ignore
--> for information on editions.

The 2018 Edition of the Rust language includes a number of improvements that
make Rust more ergonomic and easier to learn. This printing of the book
make Rust more ergonomic and easier to learn. This iteration of the book
contains a number of changes to reflect those improvements:

- Chapter 7, “Managing Growing Projects with Packages, Crates, and Modules,”
Expand All @@ -20,7 +19,7 @@ contains a number of changes to reflect those improvements:
Types that Implement Traits” that explain the new `impl Trait` syntax.
- Chapter 11 has a new section titled “Using `Result<T, E>` in Tests” that
shows how to write tests that use the `?` operator.
- The “Advanced Lifetimes” section of Chapter 19 was removed because compiler
- The “Advanced Lifetimes” section in Chapter 19 was removed because compiler
improvements have made the constructs in that section even rarer.
- The previous Appendix D, “Macros,” has been expanded to include procedural
macros and was moved to the “Macros” section in Chapter 19.
Expand All @@ -31,7 +30,7 @@ contains a number of changes to reflect those improvements:
- We fixed a number of small errors and imprecise wording throughout the book.
Thank you to the readers who reported them!

Note that any code in the first printing of *The Rust Programming Language*
Note that any code in earlier iterations of *The Rust Programming Language*
that compiled will continue to compile without `edition="2018"` in the
project’s *Cargo.toml*, even as you update the Rust compiler version you’re
using. That’s Rust’s backward compatibility guarantees at work!
Expand Down

0 comments on commit cc6a1ef

Please sign in to comment.