mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 21:29:18 +00:00
14 lines
332 B
Rust
14 lines
332 B
Rust
// This shopping list program isn't compiling!
|
|
// Use your knowledge of generics to fix it.
|
|
|
|
// Execute `rustlings hint generics1` for hints!
|
|
|
|
fn main() {
|
|
let mut shopping_list = createvec();
|
|
shopping_list.push(54);
|
|
}
|
|
fn createvec<T>() -> Vec<T> {
|
|
let mut shopping_list: Vec<T> = Vec::new();
|
|
return shopping_list;
|
|
}
|