Skip to content

Commit 571a747

Browse files
author
liv
authored
Merge pull request #87 from kosiachenko/book-references
update old book references to the second edition of the book
2 parents 2fa0fa1 + e48a1a0 commit 571a747

File tree

8 files changed

+22
-18
lines changed

8 files changed

+22
-18
lines changed

error_handling/errors2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ mod tests {
6868
// `Err(something)`. This pattern is very common in Rust, though, so there's
6969
// a `?` operator that does pretty much what you would make that match statement
7070
// do for you! Take a look at this section of the Error Handling chapter:
71-
// https://doc.rust-lang.org/book/second-edition/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-
71+
// https://doc.rust-lang.org/stable/book/second-edition/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
7272
// and give it a try!

error_handling/errorsn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl error::Error for CreationError {
124124
// can be returned from the same function because all errors act the same
125125
// since they all implement the `error::Error` trait.
126126
// Check out this section of the book:
127-
// https://doc.rust-lang.org/stable/book/second-edition/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-
127+
// https://doc.rust-lang.org/stable/book/second-edition/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
128128

129129
// Another another hint: Note that because the `?` operator returns
130130
// the *unwrapped* value in the `Ok` case, if we want to return a `Result` from

primitive_types/primitive_types3.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ fn main() {
3939

4040

4141
// There's a shorthand to initialize Arrays with a certain size that does not
42-
// require you to type in 100 items (but you certainly can if you want!)
43-
// Check out the Primitive Types -> Arrays section of the book:
44-
// https://doc.rust-lang.org/stable/book/second-edition/ch03-02-data-types.html#arrays
42+
// require you to type in 100 items (but you certainly can if you want!).
43+
// For example, you can do:
44+
// let array = ["Are we there yet?"; 10];
45+
4546
// Bonus: what are some other things you could have that would return true
4647
// for `a.len() >= 100`?

primitive_types/primitive_types4.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ fn main() {
3838

3939

4040

41-
// Take a look at the Primitive Types -> Slices section of the book:
42-
// http://doc.rust-lang.org/stable/book/primitive-types.html#slices
41+
// Take a look at the Understanding Ownership -> Slices -> Other Slices section of the book:
42+
// https://doc.rust-lang.org/stable/book/second-edition/ch04-03-slices.html#other-slices
4343
// and use the starting and ending indices of the items in the Array
4444
// that you want to end up in the slice.
4545

4646
// If you're curious why the right hand of the `==` comparison does not
4747
// have an ampersand for a reference since the left hand side is a
48-
// reference, take a look at the Deref coercions chapter:
49-
// http://doc.rust-lang.org/stable/book/deref-coercions.html
48+
// reference, take a look at the Deref coercions section of the book:
49+
// https://doc.rust-lang.org/stable/book/second-edition/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods

primitive_types/primitive_types5.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ fn main() {
3838

3939

4040

41-
// Take a look at the Primitive Types -> Tuples section of the book:
42-
// http://doc.rust-lang.org/stable/book/primitive-types.html#tuples
43-
// Particularly the part about "destructuring lets". You'll need to
44-
// make a pattern to bind `name` and `age` to the appropriate parts
41+
// Take a look at the Data Types -> The Tuple Type section of the book:
42+
// https://doc.rust-lang.org/stable/book/second-edition/ch03-02-data-types.html#the-tuple-type
43+
// Particularly the part about destructuring (second to last example in the section).
44+
// You'll need to make a pattern to bind `name` and `age` to the appropriate parts
4545
// of the tuple. You can do it!!

primitive_types/primitive_types6.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ fn main() {
3939

4040

4141
// While you could use a destructuring `let` for the tuple here, try
42-
// indexing into it instead, as explained here:
43-
// http://doc.rust-lang.org/stable/book/primitive-types.html#tuple-indexing
42+
// indexing into it instead, as explained in the last example of the
43+
// Data Types -> The Tuple Type section of the book:
44+
// https://doc.rust-lang.org/stable/book/second-edition/ch03-02-data-types.html#the-tuple-type
4445
// Now you have another tool in your toolbox!

standard_library_types/iterator3.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ mod tests {
114114

115115

116116

117-
// Minor hint: In each of the two cases in the match in main, you can create x with either a 'turbofish' or by hinting the type of x to the compiler. You may try both.
117+
// Minor hint: In each of the two cases in the match in main, you can create x with either
118+
// a 'turbofish' or by hinting the type of x to the compiler. You may try both.
118119

119120

120121

@@ -142,4 +143,5 @@ mod tests {
142143

143144

144145

145-
// Major hint: Have a look at the Iter trait and at the explanation of its collect function. Especially the part about Result is interesting.
146+
// Major hint: Have a look at the Iter trait and at the explanation of its collect function.
147+
// Especially the part about Result is interesting.

threads/threads1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() {
4545
// to **immutable** data. But we want to *change* the number of `jobs_completed`
4646
// so we'll need to also use another type that will only allow one thread to
4747
// mutate the data at a time. Take a look at this section of the book:
48-
// https://doc.rust-lang.org/stable/book/concurrency.html#safe-shared-mutable-state
48+
// https://doc.rust-lang.org/stable/book/second-edition/ch16-03-shared-state.html#atomic-reference-counting-with-arct
4949
// and keep scrolling if you'd like more hints :)
5050

5151

0 commit comments

Comments
 (0)