Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

cheater
Copy link

@cheater cheater commented Sep 22, 2025

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.

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.
@rustbot
Copy link
Collaborator

rustbot commented Sep 22, 2025

r? @marioidival

rustbot has assigned @marioidival.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

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.

3 participants