@@ -472,11 +472,9 @@ impl<T: CustomDataNotification> DataNotificationHandle<'_, T> {
472472 Box :: from_raw ( self . handle . context as * mut T )
473473 }
474474
475- pub fn unregister ( self ) -> T {
476- // NOTE: Don't drop the ctxt, return it
477- let mut slf = core:: mem:: ManuallyDrop :: new ( self ) ;
478- unsafe { slf. unregister_bv ( ) } ;
479- unsafe { * slf. extract_context ( ) }
475+ pub fn unregister ( mut self ) -> T {
476+ unsafe { self . unregister_bv ( ) } ;
477+ unsafe { * self . extract_context ( ) }
480478 }
481479}
482480
@@ -500,19 +498,17 @@ where
500498}
501499
502500impl < T : CustomDataNotification > PersistedDataNotificationHandle < ' _ , T > {
503- unsafe fn unregister_bv ( & mut self , view : & BinaryView ) {
501+ unsafe fn unregister_for_view ( & mut self , view : & BinaryView ) {
504502 BNUnregisterDataNotification ( view. handle , self . handle . as_mut ( ) )
505503 }
506504
507505 unsafe fn extract_context ( & mut self ) -> Box < T > {
508506 Box :: from_raw ( self . handle . context as * mut T )
509507 }
510508
511- pub fn unregister ( self , view : & BinaryView ) -> T {
512- // NOTE: Don't drop the ctxt, return it
513- let mut slf = core:: mem:: ManuallyDrop :: new ( self ) ;
514- unsafe { slf. unregister_bv ( view) } ;
515- unsafe { * slf. extract_context ( ) }
509+ pub fn unregister ( mut self , view : & BinaryView ) -> T {
510+ unsafe { self . unregister_for_view ( view) } ;
511+ unsafe { * self . extract_context ( ) }
516512 }
517513}
518514
0 commit comments