mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 05:09:19 +00:00
i dont even
This commit is contained in:
parent
2e90cc8458
commit
1fd62f86c4
@ -2,7 +2,7 @@
|
|||||||
// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand for a hint.
|
||||||
// You can't change anything except adding or removing references.
|
// You can't change anything except adding or removing references.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let data = "Rust is great!".to_string();
|
let data = "Rust is great!".to_string();
|
||||||
|
|||||||
@ -12,7 +12,7 @@ fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
|
|||||||
for element in v.iter_mut() {
|
for element in v.iter_mut() {
|
||||||
// TODO: Fill this up so that each element in the Vec `v` is
|
// TODO: Fill this up so that each element in the Vec `v` is
|
||||||
// multiplied by 2.
|
// multiplied by 2.
|
||||||
*i = *i * 2;
|
*element = *element * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, `v` should be equal to [4, 8, 12, 16, 20].
|
// At this point, `v` should be equal to [4, 8, 12, 16, 20].
|
||||||
@ -23,7 +23,7 @@ fn vec_map(v: &Vec<i32>) -> Vec<i32> {
|
|||||||
v.iter().map(|element| {
|
v.iter().map(|element| {
|
||||||
// TODO: Do the same thing as above - but instead of mutating the
|
// TODO: Do the same thing as above - but instead of mutating the
|
||||||
// Vec, you can just return the new number!
|
// Vec, you can just return the new number!
|
||||||
num * 2
|
element * 2
|
||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user