mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-07 03:09:19 +00:00
Exercise 28
This commit is contained in:
parent
3bb525248e
commit
1b5b56b55b
@ -6,7 +6,7 @@
|
|||||||
// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|||||||
@ -7,19 +7,19 @@
|
|||||||
// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() {
|
fn main() {
|
||||||
let vec0 = vec![22, 44, 66];
|
let vec0 = vec![22, 44, 66];
|
||||||
|
|
||||||
let mut vec1 = fill_vec(vec0);
|
let mut vec1 = fill_vec(vec0.clone());
|
||||||
|
|
||||||
assert_eq!(vec1, vec![22, 44, 66, 88]);
|
assert_eq!(vec1, vec![22, 44, 66, 88]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `fill_vec()` no longer takes `vec: Vec<i32>` as argument - don't change this!
|
// `fill_vec()` no longer takes `vec: Vec<i32>` as argument - don't change this!
|
||||||
fn fill_vec() -> Vec<i32> {
|
fn fill_vec(vec:Vec<i32>) -> Vec<i32> {
|
||||||
// Instead, let's create and fill the Vec in here - how do you do that?
|
// Instead, let's create and fill the Vec in here - how do you do that?
|
||||||
let mut vec = vec;
|
let mut vec = vec;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user