panic -> unreachable

This commit is contained in:
Tony Garnock-Jones 2019-09-20 21:43:08 +01:00
parent 72edd1327a
commit f081470b1e
1 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ impl<'a, 'b, R: Read> Decoder<'a, 'b, R> {
match *self.buf {
Some(Some(v)) => Ok(v),
Some(None) => Err(Error::Eof),
None => panic!()
None => unreachable!()
}
}
@ -118,7 +118,7 @@ impl<'a, 'b, R: Read> Decoder<'a, 'b, R> {
pub fn readbytes(&mut self, n: usize) -> Result<Vec<u8>> {
if (*self.buf).is_some() {
panic!();
unreachable!();
}
let mut bs = vec![0; n];
match self.read.read_exact(&mut bs) {
@ -280,7 +280,7 @@ impl<'a, 'b, R: Read> Decoder<'a, 'b, R> {
let n = if arg > 12 { i32::from(arg) - 16 } else { i32::from(arg) };
Ok(Value::from(n).wrap())
}
(Op::Misc(_), _) => panic!(),
(Op::Misc(_), _) => unreachable!(),
(Op::Atom(minor), arg) => {
let count = self.wirelength(arg)?;
Self::decodebinary(minor, self.readbytes(count)?)