Use unreachable!() instead of panic!()

This seems to capture the intended meaning more clearly.
This commit is contained in:
Colin Benner 2018-11-21 19:39:57 +01:00 committed by Tiffany Bennett
parent 5a0189ff77
commit e68e4f6167
3 changed files with 4 additions and 4 deletions

View file

@ -90,7 +90,7 @@ pub fn parse_date<I>(
DateToken::Dash => (-1, None),
DateToken::Plus => (1, None),
DateToken::Number(i, None) => (1, Some(i)),
_ => panic!()
_ => unreachable!()
};
let num = match num {
Some(x) => x,
@ -169,7 +169,7 @@ pub fn parse_date<I>(
}
} else {
let s = match take!(DateToken::Plus | DateToken::Dash) {
DateToken::Plus => 1, DateToken::Dash => -1, _ => panic!()
DateToken::Plus => 1, DateToken::Dash => -1, _ => unreachable!()
};
let h = take!(DateToken::Number(s, None), s);
if h.len() == 4 {

View file

@ -669,7 +669,7 @@ impl Context {
"<{}> to {} is not defined",
top.show(self),
match digits {
Digits::Default => panic!(),
Digits::Default => unreachable!(),
Digits::FullInt => "digits".to_owned(),
Digits::Digits(n) => format!("{} digits", n)
}

View file

@ -321,7 +321,7 @@ fn btree_merge<K: ::std::cmp::Ord+Clone, V:Clone, F:Fn(&V, &V) -> Option<V>>(
res.insert(akey.clone(), aval.clone());
a.next();
},
(Some(_), Some(_)) => panic!(),
(Some(_), Some(_)) => unreachable!(),
(None, Some((bkey, bval))) => {
res.insert(bkey.clone(), bval.clone());
b.next();