1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-02-08 20:00:30 +02:00

Update destructuring-enums.md (#261)

* Update destructuring-enums.md

* Update destructuring-enums.md

Following the typesetting and terminology used in https://doc.rust-lang.org/book/ch03-05-control-flow.html and https://doc.rust-lang.org/book/ch06-02-match.html

Co-authored-by: Fabian Bornhofen <fbornhofen@google.com>
This commit is contained in:
Charisee Chiw 2023-01-23 12:20:08 -08:00 committed by GitHub
parent 55fbb23cca
commit bd3642694b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,8 +32,8 @@ arm, `half` is bound to the value inside the `Ok` variant. In the second arm,
<details>
Consider demonstrating what happens if you add the third enum variant. Rust
will try to be helpful and the code won't compile, because you haven't handled
the new case in your match statements.
Key points:
* The `if`/`else` expression is returning an enum that is later unpacked with a `match`.
* You can try adding a third variant to the enum definition and displaying the errors when running the code. Point out the places where your code is now inexhaustive and how the compiler trys to give you hints.
</details>