move_semantics2

This commit is contained in:
Chris Girvin 2022-05-14 20:42:08 -04:00
parent f1722f119d
commit ef4ee0407f
2 changed files with 4 additions and 2 deletions

View File

@ -1,12 +1,11 @@
// move_semantics1.rs
// Make me compile! Execute `rustlings hint move_semantics1` for hints :)
// I AM NOT DONE
fn main() {
let vec0 = Vec::new();
let vec1 = fill_vec(vec0);
let mut vec1 = fill_vec(vec0);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);

View File

@ -7,6 +7,9 @@
fn main() {
let vec0 = Vec::new();
// solution 1
// let mut vec0_copy = &vec0;
// let mut vec1 = fill_vec(vec0_copy.to_vec());
let mut vec1 = fill_vec(vec0);
// Do not change the following line!