The docs[0] do give a more complex example of error matching:
fn main() {
let f = File::open("hello.txt");
let f = match f {
Ok(file) => file,
Err(error) => match error.kind() {
ErrorKind::NotFound => match File::create("hello.txt") {
Ok(fc) => fc,
Err(e) => panic!("Tried to create file but there was a problem: {:?}", e),
},
other_error => panic!("There was a problem opening the file: {:?}", other_error),
},
};
}
Although they also provide a slightly simpler alternative for this particular case.[0] https://doc.rust-lang.org/stable/book/ch09-02-recoverable-er...