How to do nothing in the "empty" or "remaining" case when pattern matching a string in Rust?
Hello everyone! I just started learning Rust and encountered a problem that seems very strange to me. I'm writing a simple function that takes a string and only does something for certain values. For all other values, I want nothing to happen, i.e., just skip this case.
Here's my code:
```rust
fn process_command(command: &str) {
match command {
"start" => println!("Starting..."),
"stop" => println!("Stopping..."),
"restart" => println!("Restarting..."),
// here I want to do nothing for all other commands
}
}
```
But the compiler gives an error: `non-exhaustive patterns: `_` not covered`. I understand that I need to add a catch-all pattern, but I don't want to print or execute anything. When I add `_