Skip to content

Commit

Permalink
Avoid panics in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Apr 16, 2024
1 parent 8009539 commit da49802
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rmpv/src/ext/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ impl<'a, 'de: 'a> Deserializer<'de> for &'a mut ExtDeserializer<'de> {
Cow::Borrowed(data) => visitor.visit_borrowed_bytes(data),
}
} else {
unreachable!("ext seq only has two elements");
debug_assert!(false, "ext seq only has two elements");
Err(Error::Syntax(String::new()))
}
}

Expand Down
5 changes: 4 additions & 1 deletion rmpv/src/ext/se.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ impl SerializeTuple for &mut ExtSerializer {
{
match self.fields_se {
Some(ref mut se) => value.serialize(&mut *se),
None => unreachable!(),
None => {
debug_assert!(false);
Err(Error::Syntax(String::new()))
}
}
}

Expand Down

0 comments on commit da49802

Please sign in to comment.