Commit c031685
authored
Update enum_use.md
Make code more idiomatic.
A person learning Rust for the first time seeing `use crate::Role::*` gets spun into a rabbit hole of:
- understanding what "crate::" means here
- is a single file a crate? (look it up in the docs)
- do even enums local to the file have to be specified with an absolute path from crate root?
Besides, `use crate:: ...` is taught in the example for use later on, which is linked to at the bottom of this document. Using this document to only teach about unpacking enums into the name space, and then using the other document to introduce `use crate::`, means less things need to be learned all at once, reducing confusion.1 parent 2c9b490 commit c031685
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
0 commit comments