mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-09-29 02:03:29 +00:00
Clippy doesn't warn against this, but a reexport should probably obey the same naming convention as the item it is a reexport of.
24 lines
532 B
Rust
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,
|
|
);
|
|
}
|