#Rustlang won't let you cut the branch you're sitting on.
Sometimes you need to change a complex struct or enum based on its contents. However, you can't do this inside a `match` that takes references, because the references inside the `match` keep a "lock" on the whole object and prevent it from being replaced.
The solution is to use `match` only to check the condition, and perform replacement in a separate step after the `match`.
It's better explained with code:
https://play.rust-lang.org/?gist=f7616168b8aba14a6c387a8f5df3eec7