To understand how to optimize the match statements, and hence avoid redundancy, let’s take a simple example. Let’s say we’re writing the logic for parsing the user input for a basic text-based application that adds, removes or gets employees in specific departments.

#rust 

Write Better Match Statements in Rust
1.35 GEEK