Don't allocate in expect_valid_rlp unless necessary (#8867)
* don't allocate via format! in case there's no error * fix test?
This commit is contained in:
parent
861d829420
commit
2a470deeaf
@ -53,7 +53,12 @@ impl<'a, 'view> ViewRlp<'a> where 'a : 'view {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn expect_valid_rlp<T>(&self, r: Result<T, DecoderError>) -> T {
|
fn expect_valid_rlp<T>(&self, r: Result<T, DecoderError>) -> T {
|
||||||
r.expect(&format!("View rlp is trusted and should be valid. Constructed in {} on line {}", self.file, self.line))
|
r.unwrap_or_else(|e| panic!(
|
||||||
|
"View rlp is trusted and should be valid. Constructed in {} on line {}: {}",
|
||||||
|
self.file,
|
||||||
|
self.line,
|
||||||
|
e
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns rlp at the given index, panics if no rlp at that index
|
/// Returns rlp at the given index, panics if no rlp at that index
|
||||||
|
Loading…
Reference in New Issue
Block a user