title: Change enum variant while moving the field to the new variant
body: <p>I want to update an enum variant while moving a field of the old variant to the new one without any cloning:</p>
  
  <pre><code>enum X {
      X1(String),
      X2(String),
  }
  
  fn increment_x(x: &amp;mut X) {
      *x = match *x {
          X::X1(s) =&gt; X::X2(s),
          X::X2(s) =&gt; X::X1(s),
      }
  }
  </code></pre>
  
  <p>This doesn't work because we can't move <code>s</code> from <code>&amp;mut X</code>:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0507]: cannot move out of borrowed content
   --&gt; src/lib.rs:7:16
    |
  7 |     *x = match *x {
    |                ^^
    |                |
    |                cannot move out of borrowed content
    |                help: consider removing the `*`: `x`
  8 |         X::X1(s) =&gt; X::X2(s),
    |               - data moved here
  9 |         X::X2(s) =&gt; X::X1(s),
    |               - ...and here
  </code></pre>
  
  <p>Please don't suggest things like implementing an <code>enum X { X1, X2 }</code> and using <code>struct S { variant: X, str: String }</code> etc. This is a simplified example, imagine having lots of other fields in variants, and wanting to move one field from one variant to another.</p>