title: How to eliminate partial move when calling map on an iterator
body: <p>I have a simple (I thought it should be) task to <code>map</code> values contained in a <code>Vec</code> and produce another <code>Vec</code>:</p>
  <pre><code>#[derive(Clone)]
  struct Value(u32);
  #[derive(Clone)]
  struct Id(u32);
  
  struct ValuesInfo {
      values: Vec&lt;Value&gt;,
      name: String,
      id: Id
  }
  
  struct ValueInfo{
      value: Value,
      name: String,
      id: Id
  }
  
  fn extend_values(v: Vec&lt;ValuesInfo&gt;) -&gt; Vec&lt;Vec&lt;ValueInfo&gt;&gt; {
      v.into_iter().map(|values_info|{
          values_info.values.into_iter().map(|value|{
              ValueInfo{
                  value,
                  name: values_info.name.clone(),
                  id: values_info.id.clone()
              }
          }).collect::&lt;Vec&lt;ValueInfo&gt;&gt;()
      }).collect::&lt;Vec&lt;Vec&lt;ValueInfo&gt;&gt;&gt;()
  }
  </code></pre>
  <p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=4d154acfb0daf2594e0c0d2b0da54e79" rel="nofollow noreferrer">Playground permalink</a></p>
  <p>Here I have a partial move error looking as</p>
  <pre><code>   Compiling playground v0.0.1 (/playground)
  error[E0382]: borrow of moved value: `values_info`
     --&gt; src/lib.rs:20:44
      |
  20  |         values_info.values.into_iter().map(|value|{
      |                            -----------     ^^^^^^^ value borrowed here after partial move
      |                            |
      |                            `values_info.values` moved due to this method call
  ...
  23  |                 name: values_info.name.clone(),
      |                       ----------- borrow occurs due to use in closure
      |
  note: this function consumes the receiver `self` by taking ownership of it, which moves `values_info.values`
      = note: move occurs because `values_info.values` has type `std::vec::Vec&lt;Value&gt;`, which does not implement the `Copy` trait
  
  error: aborting due to previous error
  </code></pre>
  <p>I need this partial <code>move</code> because this is what the task is about. Is there any workaround to solve the error?</p>