Skip to content

Commit

Permalink
modules exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
Joaopmorais committed Feb 19, 2024
1 parent eaead6c commit 00a22a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 2 additions & 4 deletions exercises/10_modules/modules1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a
// hint.

// 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!");
}
}

fn main() {
sausage_factory::make_sausage();
let meal = sausage_factory::make_sausage();
}
6 changes: 2 additions & 4 deletions exercises/10_modules/modules2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a
// hint.

// 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
5 changes: 2 additions & 3 deletions exercises/10_modules/modules3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a
// hint.

// 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 00a22a5

Please sign in to comment.