From: Ralf Jung Date: Wed, 14 Sep 2016 07:16:32 +0000 (+0200) Subject: Merge pull request #18 from avkrotov/toturial X-Git-Url: https://git.ralfj.de/rust-101.git/commitdiff_plain/0e18da2b0ef0112146c38a2c01f4802a845abc41?hp=bc7855f178471111de765ab46151e0b67e19a17d Merge pull request #18 from avkrotov/toturial s/toturial/tutorial/ --- 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 diff --git a/src/part09.rs b/src/part09.rs index 5916258..0ca4a43 100644 --- a/src/part09.rs +++ b/src/part09.rs @@ -89,7 +89,7 @@ fn print_digits_v2(b: &BigInt) { // **Exercise 09.1**: Write a testcase for the iterator, making sure it yields the corrects numbers. // -// **Exercise 09.2**: Write a function `iter_ldf` that iterators over the digits with the least-significant +// **Exercise 09.2**: Write a function `iter_ldf` that iterates over the digits with the least-significant // digits coming first. Write a testcase for it. // ## Iterator invalidation and lifetimes