Instructions not clear for: `modules/modules2.rs`

Open
#1,346 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
48/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Quiet
Tech stack
rust
Domain
documentation

Research direction

Start by reading modules/modules2.rs and the TODO around the use statements. Clarify that the exercise requires public re-exports with pub use as well as the fruit and veggie aliases, then verify the revised instructions make the intended change unambiguous.

Written by the indexing model from the issue text.

Description

A-exercises C-enhancement
// TODO: Fix these use statements
use self::fruits::PEAR as ???
use self::veggies::CUCUMBER as ???

// ... snip

fn main() {
    println!(
        "favorite snacks: {} and {}",
        delicious_snacks::fruit,
        delicious_snacks::veggie
    );
}

At first glance it seems as though the solution would simply be to replace the ??? with respective fruit and veggie;
However after much struggling and leaning on the rust discord community for assistance it was pointed out that the use statement itself should also be changed to pub use. This was not clear in the original problem, as the concept of making an import public is not one I'm accustomed to coming from other languages. The compiler doesn't event suggest this change, making it even more difficult to come to the correct answer without external assistance.

Dominant language
Rust
Stars
64.6k
Forks
11.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/rustlings

All issues in rust-lang/rustlings

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.