Fix assignment direction in ch19-03 nested _ example - #4824
Open
seven7763 wants to merge 1 commit into
Open
Conversation
The text said the second match arm allows `new_setting_value` to become `setting_value`, but the assignment in Listing 19-18 is `setting_value = new_setting_value` — the overwrite goes the other way. Fixes rust-lang#4822
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #4822.
The text in the "Parts of a Value with a Nested
_" section said the second match arm allowsnew_setting_valueto becomesetting_value, but the assignment in Listing 19-18 runs the other way:setting_value = new_setting_value;So it is
setting_valuethat becomesnew_setting_value(when the user has not yet customized the setting). One line, swap of the two identifiers.Changes
src/ch19-03-pattern-syntax.md: swapped the two identifiers in the sentence below Listing 19-18.Validation
listings/ch19-patterns-and-matching/listing-19-18/src/main.rs) and confirmed the assignment direction:setting_value = new_setting_value;dprint check src/ch19-03-pattern-syntax.md— the only reported formatting issue (a blank line at line 78) also exists on unmodifiedmain, so it is pre-existing and untouched by this change.Notes
None — docs-only, one line.