Commit Graph

2766 Commits

Author SHA1 Message Date
DrunkLeen
fd0c2e9007 Update appendix-06-translation.md - new persian translation added (#4192)
as I mentioned in my translation issue, I have mostly completed a translation of the Rust Book into Persian (Chapters 0 to 16) and still working on the complete chapters. While a previous translation exists, it only covers the first three or four chapters and remains incomplete.

Co-authored-by: Chris Krycho <hello@chriskrycho.com>
2025-01-08 09:46:54 -07:00
Ikram Khan
fc6451935c Remove extraneous use statement (#4193)
In Listing 14-7 of Chapter 14, the `use add_one;` statement is redundant
and can be removed. Before the Rust 2018 edition, this statement was
required to bring the `add_one` crate into scope, so it likely got
missed during refactorings from that transition.

By removing this line, the code becomes more concise and reflects the
current best practices for using external crates in Rust.

Issue #4186

---------

Co-authored-by: Chris Krycho <hello@chriskrycho.com>
2025-01-08 07:42:13 -07:00
Chris Krycho
3d058cab5b Merge pull request #4078 from marlamb/feature/take-measurement-inaccuracy-intervals-into-account
Take measurement inaccuracy intervals into account
2025-01-06 10:35:39 -07:00
Chris Krycho
f207fae674 Merge pull request #4183 from RadicalTray/main
Ch. 21.3: remove error ferris from working code
2025-01-06 09:08:48 -07:00
Chris Krycho
c36194617c Ch. 21.3: do not ignore working code in Listing 21-23 2025-01-06 09:06:07 -07:00
Chris Krycho
6ec65c38e5 Ch. 17: Set correct heading level for the chapter
Fixes #4187
2025-01-06 07:45:40 -07:00
Max Heller
70cbae602e fix typo 2024-12-30 19:08:43 -05:00
.
bbc6a52efb Ch. 21.3: remove error ferris from good code 2024-12-30 20:42:22 +07:00
Chris Krycho
04d06dfe54 Merge pull request #4175 from damoasda/ch20-01-fix
Update section name
2024-12-20 15:44:11 -07:00
Herbert Reiter
665bb1e340 Update section name 2024-12-20 18:27:25 +01:00
Mikko
2a4c00c4d0 Update text to reflect the change from '&str' to 'char' in example 2024-12-19 11:16:20 +02:00
Chris Krycho
fb444625db Merge pull request #4172 from damoasda/ch21-00-fix
Update figure number in text and file name
2024-12-18 15:54:35 -07:00
Chris Krycho
8cc8cf3ad8 Merge pull request #4171 from damoasda/ch20-05-fix
Fix chapter number
2024-12-18 15:53:36 -07:00
Chris Krycho
dcbd0b2482 Merge pull request #4170 from damoasda/ch17-03-fix
Delete unused reference
2024-12-18 15:53:04 -07:00
Chris Krycho
b33443a466 Merge pull request #4169 from damoasda/ch14-03-fix3
Remove orphaned half-sentence
2024-12-18 15:52:22 -07:00
Chris Krycho
ea696178f4 Merge pull request #4168 from damoasda/ch06-02-fix
Fix chapter number
2024-12-18 15:49:08 -07:00
Chris Krycho
17e2dcb382 Ch. 10.1: further clarify graf about methods in impl<T> ... blocks 2024-12-18 15:42:10 -07:00
Chris Krycho
7982ad015a Merge main into TruscaPetre:patch-1 2024-12-18 15:34:46 -07:00
Herbert Reiter
a949500cf3 Update figure number in text and file name 2024-12-18 21:20:06 +01:00
Herbert Reiter
b223384b10 Fix chapter number 2024-12-18 21:15:01 +01:00
Herbert Reiter
dc6ebf263b Delete unused reference 2024-12-18 21:07:47 +01:00
Herbert Reiter
f87d091a95 Remove orphaned half-sentence 2024-12-18 21:01:40 +01:00
Herbert Reiter
8863a72dee Fix chapter number 2024-12-18 20:46:24 +01:00
Chris Krycho
1855609b2c Merge pull request #4098 from forresthopkinsa/patch-1
Fix minor grammatical error
2024-12-18 10:38:19 -07:00
Chris Krycho
a945c6567b Merge pull request #3608 from LennySCSZ/main
Update appendix-06-translation.md to add another Chinese translation.
2024-12-18 10:34:22 -07:00
Chris Krycho
b99b3f9647 Merge branch 'main' into patch-1 2024-12-18 10:34:01 -07:00
Chris Krycho
0566029791 Ch. 5.3: dodge a grammatical tripwire
Which verb tense matches? Make it so we don’t have to care!
2024-12-18 10:32:57 -07:00
Chris Krycho
9175d69807 Link to GH rather than xfoss in Translations list 2024-12-18 10:25:33 -07:00
Chris Krycho
2f61a8d68c Merge pull request #3625 from rinthel/patch-1
Change Korean translation repo to newer
2024-12-16 12:51:52 -07:00
Chris Krycho
cd5ac75f7d Merge main into joeljosedev/main and apply changes to src 2024-12-16 12:32:12 -07:00
Chris Krycho
f75817ae2e Ch. 20: conclude §01 with a reference to the Rustonomicon 2024-12-16 11:12:37 -07:00
Chris Krycho
80d6bbeacb Ch. 10: clarify note about compiler errors and 'static
- Merge in `main` and resolve merge conflicts.
- Integrate both branches’ suggestions, then rephrase to stay closer to
  the original output.
2024-12-16 09:05:52 -07:00
Brian G. Merrell
01f0b1bbb4 Help with ambiguity about 'static lifetimes 2024-12-14 03:05:15 -07:00
Chris Krycho
1787dd1c62 Integrate and update 'veera-sivarajan:add-letElse'
- Merge in changes from `main`, including moving the chapter.
- Merge in newly-written introduction of `let-else` in the same section
  as the `if let` discussion.
- Rewrap lines.
2024-12-13 14:24:21 -07:00
Chris Krycho
0b5713345a Ch. 6: Introduce let-else after if let.
This is not technically part of the 2024 Edition, since it is available
on the 2021 edition as well, but it *will* be an important update for
the 2024 Edition revision of the print book!
2024-12-13 14:24:21 -07:00
Chris Krycho
fa7e1c3eab Merge 'main' into 'pitaj:patch-1' 2024-12-12 16:28:53 -07:00
Egor Suvorov
b195aeb56e ch18-03: Matching Named Variables: mention if let/while let (#3110)
* Matching Named Variables: mention `if let`/`while let`

    `if let` and `while let` introduce new scope for named variables just like `match`. However, they do not support match guards yet, see RFC 2497.

* Ch. 19: further clarify discussion of `if|while let` patterns

    - While keeping the note about `if let` and `while let` when introducing
      the discussion of matching named variables, bring the phrasing back
      closer to the original.
    - Move the distinction that `if let` and `while let` do not have the
      equivalent of match guards down to the discussion of match guards.
    - Line wrapping.

---------

Co-authored-by: Chris Krycho <hello@chriskrycho.com>
2024-12-12 10:22:44 -07:00
Aizon
c9820adbfa Ch. 4: Rephrase/clarify paragraph on reference scope (#3688)
Co-authored-by: Chris Krycho <hello@chriskrycho.com>
2024-12-12 09:45:20 -07:00
Chris Krycho
a5ccba9db7 Merge pull request #3699 from proski/closure-note
Simplify note about functions in ch13-01-closures.md
2024-12-12 09:10:55 -07:00
Chris Krycho
60b198a27f Further clarify note about functions implementing Fn traits 2024-12-12 08:49:16 -07:00
Chris Krycho
addb9e1f41 Update src/ch04-03-slices.md for formatting 2024-12-12 07:53:24 -07:00
spotlesscoder
66ef2b6fcb Merge branch 'main' into patch-1 2024-12-12 07:29:25 +01:00
Chris Krycho
a3d57965e4 Merge main into bravequickcleverfibreyarn:ch17-02-trait-objects.md 2024-12-11 13:07:24 -07:00
Chris Krycho
bfd6016a7a Ch. 21: Rename a no-listing listing so its name is sensible 2024-12-11 10:24:23 -07:00
Chris Krycho
e195ff4119 Ch. 21: word-smithing and further code tweaks to use Vec::drain 2024-12-11 09:53:42 -07:00
Wanten
815bd7bba7 fix(typo): correct punctuation in ch15-06-reference-cycles.md 2024-12-10 20:14:23 +08:00
Chris Krycho
8bad93e0c3 Ch. 20: show both impl Fn and Box<dyn Fn>
The existing text here has a long historical record; it predates `impl`
or `dyn` existing at all, much less the version we landed on in Rust
2018. Update it to suggest defaulting to `impl Fn`, with trait objects
`Box<dyn Fn>` the fallback.

Fixes #1514
Fixes #3272
2024-12-09 17:37:24 -07:00
Chris Krycho
fcfac818c7 Merge main into PR #3188 2024-12-09 15:56:11 -07:00
Chris Krycho
2186da27a8 Remove emphasis on four-space indents
I suspect this one goes *allllll* the way back to Rust for Rubyists.

Fixes #3759
2024-12-09 15:18:03 -07:00
Chris Krycho
6f0d1f8f41 Rust 2024: distinguish unsafe fn vs. unsafe blocks
The former is no longer always treated as an unsafe block (without a
warning, anyway), as implementation of [RFC #2585][rfc] progresses; the
`unsafe fn` declares an obligation and the `unsafe` block upholds it.

Fixes #4147

[rfc]: https://rust-lang.github.io/rfcs/2585-unsafe-block-in-unsafe-fn.html
2024-12-09 10:49:31 -07:00