File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -815,11 +815,7 @@ impl OwnedAnyUserData {
815
815
impl < ' lua > AnyUserData < ' lua > {
816
816
/// Checks whether the type of this userdata is `T`.
817
817
pub fn is < T : ' static > ( & self ) -> bool {
818
- match self . inspect ( |_: & UserDataCell < T > | Ok ( ( ) ) ) {
819
- Ok ( ( ) ) => true ,
820
- Err ( Error :: UserDataTypeMismatch ) => false ,
821
- Err ( _) => unreachable ! ( ) ,
822
- }
818
+ self . inspect ( |_: & UserDataCell < T > | Ok ( ( ) ) ) . is_ok ( )
823
819
}
824
820
825
821
/// Borrow this userdata immutably if it is of type `T`.
Original file line number Diff line number Diff line change @@ -370,6 +370,8 @@ fn test_userdata_take() -> Result<()> {
370
370
r => panic ! ( "improper return for destructed userdata: {:?}" , r) ,
371
371
}
372
372
373
+ assert ! ( !userdata. is:: <MyUserdata >( ) ) ;
374
+
373
375
drop ( userdata) ;
374
376
lua. globals ( ) . raw_remove ( "userdata" ) ?;
375
377
lua. gc_collect ( ) ?;
You can’t perform that action at this time.
0 commit comments