Remove redundant "match" when checking userdata type via AnyUserData::is.

Fixes #386
This commit is contained in:
Alex Orlenko
2024-03-20 19:29:47 +00:00
parent 3d43103431
commit 58be624222
2 changed files with 3 additions and 5 deletions
+1 -5
View File
@@ -815,11 +815,7 @@ impl OwnedAnyUserData {
impl<'lua> AnyUserData<'lua> {
/// Checks whether the type of this userdata is `T`.
pub fn is<T: 'static>(&self) -> bool {
match self.inspect(|_: &UserDataCell<T>| Ok(())) {
Ok(()) => true,
Err(Error::UserDataTypeMismatch) => false,
Err(_) => unreachable!(),
}
self.inspect(|_: &UserDataCell<T>| Ok(())).is_ok()
}
/// Borrow this userdata immutably if it is of type `T`.