Commit Graph

2074 Commits

Author SHA1 Message Date
Dan Gohman
48fb3a79ef Add use super::*; to unit-test examples.
rust-lang/cargo#10706 switched the `cargo init --lib`-generated src/lib.rs
to use a function and `use super::*;` inside the `mod test`. This makes
it easier for new users to write their own functions and add tests, as it
means the tests can refer to the new functions without any extra work, and
without rustc asking them to add explicit `use`s for each new thing they add.

This PR updates the parts of the book that use this src/lib.rs and
similar examples, to match the new output of `cargo init --lib`, and to
additionally help guide users to using `use super::*;` inside their
`mod test`s.

There is one non-example change, which is to update the wording in
src/ch11-01-writing-tests.md to better reflect the new content in the
associated example.
2022-11-10 16:29:15 -08:00
Carol (Nichols || Goulding)
3f64052c04 Upgrade to Rust 1.65 2022-11-03 22:13:58 -04:00
Carol (Nichols || Goulding)
19c75074d1 Upgrade to Rust 1.64 2022-11-03 22:13:58 -04:00
Carol (Nichols || Goulding)
10bf4a3dbd Upgrade to Rust 1.63 2022-11-03 22:13:58 -04:00
Carol (Nichols || Goulding)
3962c0224b Clarify that the conditional expression is the one under discussion
Rather than the return expression.

Fixes #3168.
2022-10-28 16:42:57 -04:00
Carol (Nichols || Goulding)
bb7e429ad6 Updates from copyedit of ch6 2022-10-28 16:42:57 -04:00
The JavaScript / TypeScript Guy
75584ed8f6 Made Option<T> error explanation more clear 2022-10-28 16:33:23 -04:00
The JavaScript / TypeScript Guy
be240bd824 Update ch06-01-defining-an-enum
Added more clarity in the first sentence of the example for "Option" Enum.
2022-10-28 16:33:23 -04:00
Carol (Nichols || Goulding)
a371f82b09 Clarify that user1 can't be used as a whole instance. Fixes #2978. 2022-10-27 16:00:51 -04:00
Carol (Nichols || Goulding)
d339373a83 Fix plural and incorrect phrase. Fixes #3359. 2022-10-27 16:00:51 -04:00
Carol (Nichols || Goulding)
8612c4a580 Updates from copyedit of ch5 2022-10-27 16:00:51 -04:00
Artoghrul Gahramanli
aa5ee485bd Remove Turkish translation
It doesn't seem to be maintained since last year, and the website link (https://rustdili.github.io/) doesn't load.
2022-10-20 16:49:55 -04:00
Carol (Nichols || Goulding)
3d51f70c78 Update chapter 4 from latest print edits 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
d0acb2595c Update chapter 3 from latest print edits 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
e9e0b970a4 Clarify division truncates toward zero. Fixes #2856. 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
699adc6f5c Update chapter 2 from latest print edits 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
9a3822ee96 Explain both kinds of format string arguments
Fixes #3325.
2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
f801008f55 Update chapter 1 from latest print edits 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
5057f157cd Updated snapshot of the appendices 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
856d89c53a Updated snapshot of ch16 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
5a3a64d60b Update snapshot of ch15 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
3f2a6ef489 Messy snapshot of chapter 14 after checking copyedit 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
704c51eec2 Regenerate manual output for chapter 14 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
2921743516 Update snapshot of chapter 9 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
06ea00d9ca Update println style in ch8 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
55f2474e71 Upgrade to rand 0.8.5 2022-10-20 16:39:55 -04:00
Carol (Nichols || Goulding)
ace3550ad8 Propagate frontmatter edits to src 2022-10-20 16:39:55 -04:00
int-y1
f1e5ad844d Fix punctuation in ch05-02 2022-09-19 09:48:21 -04:00
JirCep
8aecae3efe Ownership move chapter link fix
Ownership move into closure is discussed in ?_Capturing References or Moving Ownership_ section.
2022-09-12 22:41:11 +02:00
Yiannis Hadjicharalambous
eabaaaa90e Wrong listing number 2022-09-08 10:47:24 -04:00
Carol (Nichols || Goulding)
0514b1cf34 Reword text around box 2022-09-06 10:21:25 -04:00
JirCep
a1db62fce3 Box<T> instead of "box"
Since no other _simple_ occurrences, I found this as bug.
2022-09-06 10:18:56 -04:00
yjhn
e78b9f0d31 Update Clippy output in Appendix D 2022-09-06 10:16:22 -04:00
Vishal Lama
0a5421ceb2 Add a missing line generated by 'cargo new'
When running `cargo new hello_cargo` in the command line, one of the lines automatically generated in the Cargo.toml file of the `hello_cargo` project is a comment regarding more keys and their definitions. This comment is currently missing in the book chapter, and it probably should be added there.
2022-08-28 19:51:04 -04:00
mjh
98c6225e5f Clarify ThreadPool-Worker analogy wording 2022-08-18 21:15:06 -04:00
Carol (Nichols || Goulding)
bcea0e43ea Put interactive book notice in a blockquote box to draw attention to it 2022-08-17 10:15:54 -04:00
Carol (Nichols || Goulding)
a39854bdc9 Remove the word 'new' because someday it won't be new anymore 2022-08-17 10:07:00 -04:00
Carol (Nichols || Goulding)
769d98ce0f Merge remote-tracking branch 'origin/pr/3304' 2022-08-17 10:02:37 -04:00
Brian Fakhoury
42ca0ef484 Missing period at end of sentence 2022-08-12 21:52:02 -04:00
Will Crichton
e6517ebd04 Add link to experimental Rust Book 2022-08-09 10:44:25 -07:00
IDJack
64a3622e45 Fix grammar in ch06-02 2022-08-08 21:32:59 -04:00
Andy Barnard
36383b4da2 Update ch16-02-message-passing.md
Fixed a grammatical error
2022-07-19 21:03:20 -04:00
Carol (Nichols || Goulding)
83788ff212 Update snapshots with edits made to src that need to be checked 2022-07-14 21:33:04 -04:00
yjhn
929d9cc5e4 add missing b in chapter 15.6 2022-07-14 20:43:21 -04:00
shanedroogan
4fe92fb0a3 Grammar: corrected 'as much' to 'as such'
The context suggests that this sentence is meant to clarify that a
detail was left out prior; i.e. 'We did not call `String` by this name'
as opposed to 'We did not call `String` as frequently'.
2022-07-14 20:41:57 -04:00
yjhn
4ea9b2e0da grammar: add missing 'of' 2022-07-14 20:41:33 -04:00
Christian Koopmann
a2cb72d3ad Fix incorrect link for listing 13-06 2022-07-14 20:31:33 -04:00
LeonGr
bf755d4d46 Correct method name
The text in chapter 13.1 mentions a method `shirt_giveaway`, which is
actually named `giveaway` in the relevant listing and the text further
on.
2022-07-14 20:30:33 -04:00
Carol (Nichols || Goulding)
2fe9eff266 Update to Rust 1.62 2022-07-04 21:17:25 -04:00
Carol (Nichols || Goulding)
92bfbfacf8 Extract where clause example so it'll get rustfmtted in the future 2022-07-04 21:05:33 -04:00