Update: new version rand -> 0.9.2 and change code syntax. #4585
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request finalizes the code for the Chapter 2 guessing game tutorial, implementing the completed logic across the sequential steps (02-02 through 02-06).
Changes Included:
src/main.rsfile in the listing directory was updated with the full, final guessing game logic, combining the steps for input, random number generation (secret_number), looping, and comparison usingmatch.randcrate version was updated to0.9.2in the project manifest (listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.toml).rand = "0.9.2"dependency was added topackages/trpl/Cargo.tomlto ensure the book's embedded Rust documentation tests (doctests) can successfully compile and run, resolving the previousunresolved import randerror.Why
The purpose of this contribution is three-fold: to ensure the educational content is complete, to maintain dependency hygiene, and to fix a critical test failure in the continuous integration (CI) pipeline.
rand) to a newer version, which is a key part of routine maintenance.packages/trpl/Cargo.tomlresolves a compilation error in the book's test harness, ensuring the overall repository test suite remains healthy and passes.Verification
All code has been locally compiled, formatted (
rustfmt,dprint), and verified to run correctly.