From: Ralf Jung Date: Wed, 14 Sep 2016 07:11:02 +0000 (+0200) Subject: Merge pull request #15 from avkrotov/iterators X-Git-Url: https://git.ralfj.de/rust-101.git/commitdiff_plain/1eb60908c4cf9eb7e37f89c90440f7bea6367583?hp=9d1af570905e182beb0acb3585ec7eef7f64e09e Merge pull request #15 from avkrotov/iterators s/that iterators/that iterates/ --- diff --git a/src/part06.rs b/src/part06.rs index 4c0e6ce..7113094 100644 --- a/src/part06.rs +++ b/src/part06.rs @@ -44,7 +44,7 @@ fn vec_min(v: &Vec) -> Option { //@ The answer is already hidden in the type of `vec_min`: `v` is just borrowed, but //@ the Option that it returns is *owned*. We can't just return one of the elements of `v`, //@ as that would mean that it is no longer in the vector! In our code, this comes up when we update -//@ the intermediate variable `min`, which also has type `Option`. If you replace get rid of the +//@ the intermediate variable `min`, which also has type `Option`. If you get rid of the //@ `e.clone()`, Rust will complain "Cannot move out of borrowed content". That's because //@ `e` is a `&BigInt`. Assigning `min = Some(*e)` works just like a function call: Ownership of the //@ underlying data is transferred from `e` to `min`. But that's not allowed, since