From 2835ca7fa627b4cc4cc804090b21c10a7f5d5f3a Mon Sep 17 00:00:00 2001 From: jaluspeet <39632922+jaluspeet@users.noreply.github.com> Date: Tue, 2 May 2023 18:08:32 +0200 Subject: [PATCH] bingo bango --- exercises/primitive_types/primitive_types4.rs | 4 ++-- exercises/primitive_types/primitive_types5.rs | 3 +-- exercises/primitive_types/primitive_types6.rs | 3 +-- exercises/vecs/vecs1.rs | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/exercises/primitive_types/primitive_types4.rs b/exercises/primitive_types/primitive_types4.rs index 23516833..73dcf8c5 100644 --- a/exercises/primitive_types/primitive_types4.rs +++ b/exercises/primitive_types/primitive_types4.rs @@ -2,13 +2,13 @@ // Get a slice out of Array a where the ??? is so that the test passes. // Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE + #[test] fn slice_out_of_array() { let a = [1, 2, 3, 4, 5]; - let nice_slice = + let nice_slice = &a[1..4]; assert_eq!([2, 3, 4], nice_slice) } diff --git a/exercises/primitive_types/primitive_types5.rs b/exercises/primitive_types/primitive_types5.rs index 4fd9141f..76a92b88 100644 --- a/exercises/primitive_types/primitive_types5.rs +++ b/exercises/primitive_types/primitive_types5.rs @@ -2,11 +2,10 @@ // Destructure the `cat` tuple so that the println will work. // Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE fn main() { let cat = ("Furry McFurson", 3.5); - let /* your pattern here */ = cat; + let (name, age) = cat; println!("{} is {} years old.", name, age); } diff --git a/exercises/primitive_types/primitive_types6.rs b/exercises/primitive_types/primitive_types6.rs index ddf8b423..c35d4625 100644 --- a/exercises/primitive_types/primitive_types6.rs +++ b/exercises/primitive_types/primitive_types6.rs @@ -3,13 +3,12 @@ // You can put the expression for the second element where ??? is so that the test passes. // Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE #[test] fn indexing_tuple() { let numbers = (1, 2, 3); // Replace below ??? with the tuple indexing syntax. - let second = ???; + let second = numbers.1; assert_eq!(2, second, "This is not the 2nd number in the tuple!") diff --git a/exercises/vecs/vecs1.rs b/exercises/vecs/vecs1.rs index 4e8c4cbb..893614f4 100644 --- a/exercises/vecs/vecs1.rs +++ b/exercises/vecs/vecs1.rs @@ -4,11 +4,10 @@ // Make me compile and pass the test! // Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE fn array_and_vec() -> ([i32; 4], Vec) { let a = [10, 20, 30, 40]; // a plain array - let v = // TODO: declare your vector here with the macro for vectors + let v = vec![10, 20, 30, 40]; // TODO: declare your vector here with the macro for vectors (a, v) }