Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 1a56bff

Browse files
committed
Don't imply that exhaustive match is the whole refactoring story
1 parent c360ae2 commit 1a56bff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ In Rust, declarations tend to come with explicit types, while actual code has it
194194

195195
To aid in refactoring and clarity.
196196

197-
First, if every possibility is covered by the `match`, adding variants to the `enum` in the future will cause a compilation failure, rather than an error at runtime. This compiler assistance makes fearless refactoring possible in Rust.
197+
First, if every possibility is covered by the `match`, adding variants to the `enum` in the future will cause a compilation failure, rather than an error at runtime. This type of compiler assistance makes fearless refactoring possible in Rust.
198198

199199
Second, exhaustive checking makes the semantics of the default case explicit: in general, the only safe way to have a non-exhaustive `match` would be to panic the thread if nothing is matched. Early versions of Rust did not require `match` cases to be exhaustive and it was found to be a great source of bugs.
200200

0 commit comments

Comments
 (0)