Replace match blocks with .expect calls.

This commit is contained in:
Dan Gohman
2017-08-30 11:17:25 -07:00
parent 5e99a4fb6a
commit 110697cfdd

View File

@@ -298,15 +298,11 @@ impl<Variable> SSABuilder<Variable>
/// Gets the header block corresponding to an Ebb, panics if the Ebb or the header block /// Gets the header block corresponding to an Ebb, panics if the Ebb or the header block
/// isn't declared. /// isn't declared.
pub fn header_block(&self, ebb: Ebb) -> Block { pub fn header_block(&self, ebb: Ebb) -> Block {
match self.ebb_headers.get(ebb) { self.ebb_headers
Some(&header) => { .get(ebb)
match header.expand() { .expect("the ebb has not been declared")
Some(header) => header, .expand()
None => panic!("the header block has not been defined"), .expect("the header block has not been defined")
}
}
None => panic!("the ebb has not been declared"),
}
} }
/// Declares a new predecessor for an `Ebb` header block and record the branch instruction /// Declares a new predecessor for an `Ebb` header block and record the branch instruction