summaryrefslogtreecommitdiff
path: root/exercises/10_modules/modules2.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-22 13:24:06 +0200
committermo8it <mo8it@proton.me>2024-06-22 13:24:06 +0200
commit98cd00de6378550985d819ac8cd1227c8a10818e (patch)
treefe9d6d460813a043f7abbac7e063ce46c432b7af /exercises/10_modules/modules2.rs
parentecbe9b7324364e94f7c6b4a4dd279fb90f5a938e (diff)
modules2 solution
Diffstat (limited to 'exercises/10_modules/modules2.rs')
-rw-r--r--exercises/10_modules/modules2.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/exercises/10_modules/modules2.rs b/exercises/10_modules/modules2.rs
index 5f8b0d5..24dce41 100644
--- a/exercises/10_modules/modules2.rs
+++ b/exercises/10_modules/modules2.rs
@@ -1,20 +1,19 @@
// You can bring module paths into scopes and provide new names for them with
-// the 'use' and 'as' keywords. Fix these 'use' statements to make the code
-// compile.
+// the `use` and `as` keywords.
mod delicious_snacks {
- // TODO: Fix these use statements
- use self::fruits::PEAR as ???
- use self::veggies::CUCUMBER as ???
+ // TODO: Add the follwing two `use` statements after fixing them.
+ // use self::fruits::PEAR as ???;
+ // use self::veggies::CUCUMBER as ???;
mod fruits {
- pub const PEAR: &'static str = "Pear";
- pub const APPLE: &'static str = "Apple";
+ pub const PEAR: &str = "Pear";
+ pub const APPLE: &str = "Apple";
}
mod veggies {
- pub const CUCUMBER: &'static str = "Cucumber";
- pub const CARROT: &'static str = "Carrot";
+ pub const CUCUMBER: &str = "Cucumber";
+ pub const CARROT: &str = "Carrot";
}
}
@@ -22,6 +21,6 @@ fn main() {
println!(
"favorite snacks: {} and {}",
delicious_snacks::fruit,
- delicious_snacks::veggie
+ delicious_snacks::veggie,
);
}