Files
rustlings/solutions/10_modules/modules2.rs
Remo Senekowitsch 3dfced8c67 modules2: obey name convention for reexported consts
Clippy doesn't warn against this, but a reexport should probably obey
the same naming convention as the item it is a reexport of.
2026-09-28 15:29:30 +02:00

24 lines
532 B
Rust

mod delicious_snacks {
// Added `pub` and used the expected alias after `as`.
pub use self::fruits::PEAR as FRUIT;
pub use self::veggies::CUCUMBER as VEGGIE;
mod fruits {
pub const PEAR: &str = "Pear";
pub const APPLE: &str = "Apple";
}
mod veggies {
pub const CUCUMBER: &str = "Cucumber";
pub const CARROT: &str = "Carrot";
}
}
fn main() {
println!(
"favorite snacks: {} and {}",
delicious_snacks::FRUIT,
delicious_snacks::VEGGIE,
);
}