Skip to content

Commit 05f65d6

Browse files
author
liv
committedJan 23, 2019
thematically refactor modules2
1 parent f447ade commit 05f65d6

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed
 

‎exercises/modules/modules2.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// modules2.rs
22
// Make me compile! Scroll down for hints :)
33

4-
mod us_presidential_frontrunners {
5-
use self::democrats::HILLARY_CLINTON as democrat;
6-
use self::republicans::DONALD_TRUMP as republican;
4+
mod delicious_snacks {
5+
use self::fruits::PEAR as fruit;
6+
use self::veggies::CUCUMBER as veggie;
77

8-
mod democrats {
9-
pub const HILLARY_CLINTON: &'static str = "Hillary Clinton";
10-
pub const BERNIE_SANDERS: &'static str = "Bernie Sanders";
8+
mod fruits {
9+
pub const PEAR: &'static str = "Pear";
10+
pub const APPLE: &'static str = "Apple";
1111
}
1212

13-
mod republicans {
14-
pub const DONALD_TRUMP: &'static str = "Donald Trump";
15-
pub const JEB_BUSH: &'static str = "Jeb Bush";
13+
mod veggies {
14+
pub const CUCUMBER: &'static str = "Cucumber";
15+
pub const CARROT: &'static str = "Carrot";
1616
}
1717
}
1818

1919
fn main() {
20-
println!("candidates: {} and {}",
21-
us_presidential_frontrunners::democrat,
22-
us_presidential_frontrunners::republican);
20+
println!("favorite snacks: {} and {}",
21+
delicious_snacks::fruit,
22+
delicious_snacks::veggie);
2323
}
2424

2525

@@ -38,8 +38,8 @@ fn main() {
3838

3939

4040

41-
// The us_presidential_frontrunners module is trying to present an external
42-
// interface (the `democrat` and `republican` constants) that is different than
43-
// its internal structure (the `democrats` and `republicans` modules and
41+
// The delicious_snacks module is trying to present an external
42+
// interface (the `fruit` and `veggie` constants) that is different than
43+
// its internal structure (the `fruits` and `veggies` modules and
4444
// associated constants). It's almost there except for one keyword missing for
4545
// each constant.

0 commit comments

Comments
 (0)
Please sign in to comment.