Unwrap inner type when enum variant is known : <p>I have this enum type:</p>

<pre><code>enum Animal {
    Dog(i32),
    Cat(u8),
}
</code></pre>

<p>Now I have a function that takes this type as parameter. I <em>know</em> (for some reason) that the input is always a <code>Cat</code>. I want to achieve this:</p>

<pre><code>fn count_legs_of_cat(animal: Animal) -&gt; u8 {
    if let Animal::Cat(c) = animal { c } else { unreachable!() }
}
</code></pre>

<p>Can I write this shorter and/or more idiomatic?</p>
