Reducce panic messages.

This commit is contained in:
Stephen Chung
2021-11-13 12:23:35 +08:00
parent c8aab47f50
commit 38884ede46
16 changed files with 161 additions and 248 deletions

View File

@@ -568,7 +568,7 @@ where
) -> Result<V::Value, Box<EvalAltResult>> {
// Deserialize each value item coming out of the iterator.
seed.deserialize(&mut DynamicDeserializer::from_dynamic(
self.values.next().expect("value should exist"),
self.values.next().expect("exists"),
))
}
}

View File

@@ -53,27 +53,21 @@ struct FnParam {
impl PartialOrd for FnParam {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(
match self
.name
.partial_cmp(&other.name)
.expect("String::partial_cmp should succeed")
{
Ordering::Less => Ordering::Less,
Ordering::Greater => Ordering::Greater,
Ordering::Equal => match (self.typ.is_none(), other.typ.is_none()) {
(true, true) => Ordering::Equal,
(true, false) => Ordering::Greater,
(false, true) => Ordering::Less,
(false, false) => self
.typ
.as_ref()
.expect("`typ` is not `None`")
.partial_cmp(other.typ.as_ref().expect("`typ` is not `None`"))
.expect("String::partial_cmp should succeed"),
},
Some(match self.name.partial_cmp(&other.name).expect("succeed") {
Ordering::Less => Ordering::Less,
Ordering::Greater => Ordering::Greater,
Ordering::Equal => match (self.typ.is_none(), other.typ.is_none()) {
(true, true) => Ordering::Equal,
(true, false) => Ordering::Greater,
(false, true) => Ordering::Less,
(false, false) => self
.typ
.as_ref()
.expect("`Some`")
.partial_cmp(other.typ.as_ref().expect("`Some`"))
.expect("succeed"),
},
)
})
}
}