-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use non deprecated functions in Chapter 2. Programming a Guessing Game #4217
base: main
Are you sure you want to change the base?
Conversation
Dont forget to update the rand version shown in the chapter too along with the |
Thank you! I’ll take a look at this later this week as part of my work to prepare the book for the 2024 Edition release! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are solid—thank you! We need a few more to be able to land this:
-
A better title for this is “Update to use
rand
0.9 throughout”. Those functions are not deprecated on the version that the book is using, after all! -
We do indeed need to update all instances of
rand = "0.8.5"
torand = "0.9.0"
in theCargo.toml
files throughout.1 That includes in the text immediately after including Listing 2-2, which itself shows addingrand
to theCargo.toml
file.That will also flag up the need for some changes in Chapter 14!
-
We also need to update the sections Ensuring Reproducible Builds with the Cargo.lock File and Updating a Crate to Get a New Version in Ch. 2 to use 0.9.0 as the starting point and 0.9.1 and 0.10.0 as the “new versions” in the text, in the
manual-regeneration
comment, and in the code samples.
Footnotes
-
It’s quite surprising to me that this is passing CI at the moment! But that’s an issue with something about how we’re running
mdbook test
and not specific to this PR. I will follow up on that in parallel to our landing this. ↩
Chapter 2. Programming a Guessing Game uses
thread_rng()
andgen_range()
, which are deprecated.I replaced every
thread_rng()
withrng()
, and everygen_range()
withrandom_range()
The function is also referenced in a few other areas, of which I updated.