1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2025-10-12 13:35:20 -04:00

Clean up and unify exercises

This commit is contained in:
mo8it 2024-04-17 23:34:27 +02:00
commit 2f810a4da6
96 changed files with 267 additions and 635 deletions
exercises/05_vecs

View file

@ -1,11 +1,7 @@
// vecs1.rs
//
// Your task is to create a `Vec` which holds the exact same elements as in the
// array `a`.
//
// Make me compile and pass the test!
//
// Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint.
fn array_and_vec() -> ([i32; 4], Vec<i32>) {
let a = [10, 20, 30, 40]; // a plain array

View file

@ -1,11 +1,7 @@
// vecs2.rs
//
// A Vec of even numbers is given. Your task is to complete the loop so that
// each number in the Vec is multiplied by 2.
//
// Make me pass the test!
//
// Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint.
fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
for element in v.iter_mut() {