Skip to content

Commit

Permalink
Completed module system exercises.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aziz Unsal authored and Aziz Unsal committed Oct 27, 2022
1 parent e1f5e76 commit 24de487
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions exercises/modules/modules1.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// modules1.rs
// Make me compile! Execute `rustlings hint modules1` for hints :)

// I AM NOT DONE

mod sausage_factory {
// Don't let anybody outside of this module see this!
fn get_secret_recipe() -> String {
String::from("Ginger")
}

fn make_sausage() {
pub fn make_sausage() {
get_secret_recipe();
println!("sausage!");
}
Expand Down
7 changes: 2 additions & 5 deletions exercises/modules/modules2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
// 'use' and 'as' keywords. Fix these 'use' statements to make the code compile.
// Make me compile! Execute `rustlings hint modules2` for hints :)

// I AM NOT DONE

mod delicious_snacks {

// TODO: Fix these use statements
use self::fruits::PEAR as ???
use self::veggies::CUCUMBER as ???
pub use self::fruits::PEAR as fruit;
pub use self::veggies::CUCUMBER as veggie;

mod fruits {
pub const PEAR: &'static str = "Pear";
Expand Down
4 changes: 1 addition & 3 deletions exercises/modules/modules3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
// from the std::time module. Bonus style points if you can do it with one line!
// Make me compile! Execute `rustlings hint modules3` for hints :)

// I AM NOT DONE

// TODO: Complete this use statement
use ???
use std::time::{SystemTime, UNIX_EPOCH};

fn main() {
match SystemTime::now().duration_since(UNIX_EPOCH) {
Expand Down

0 comments on commit 24de487

Please sign in to comment.