mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 05:34:14 +00:00
Use unreachable!()
instead of panic!()
This seems to capture the intended meaning more clearly.
This commit is contained in:
parent
5a0189ff77
commit
e68e4f6167
3 changed files with 4 additions and 4 deletions
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue