Skip to content

Fix assignment direction in ch19-03 nested _ example - #4824

Open
seven7763 wants to merge 1 commit into
rust-lang:mainfrom
seven7763:fix/ch19-03-assignment-direction
Open

Fix assignment direction in ch19-03 nested _ example#4824
seven7763 wants to merge 1 commit into
rust-lang:mainfrom
seven7763:fix/ch19-03-assignment-direction

Conversation

@seven7763

Copy link
Copy Markdown

Summary

Fixes #4822.

The text in the "Parts of a Value with a Nested _" section said the second match arm allows new_setting_value to become setting_value, but the assignment in Listing 19-18 runs the other way:

setting_value = new_setting_value;

So it is setting_value that becomes new_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

  • Read Listing 19-18 (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 unmodified main, so it is pre-existing and untouched by this change.

Notes

None — docs-only, one line.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation issue in Section 19.3

1 participant