test(fix-doctest): fix doctests where a function si wrapped around a doctest but the function is never called

This commit is contained in:
David Niehues
2024-12-15 20:34:33 +01:00
parent 255e377d29
commit ff7827c24e
3 changed files with 4 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ pub type MallocVec<T> = allocator_api2::vec::Vec<T, MallocAllocator>;
/// # assert_eq!(*malloc_box, 42u8); /// # assert_eq!(*malloc_box, 42u8);
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// # let _ = do_test();
/// ``` /// ```
pub fn malloc_box_try<T>(x: T) -> Result<MallocBox<T>, AllocError> { pub fn malloc_box_try<T>(x: T) -> Result<MallocBox<T>, AllocError> {
MallocBox::<T>::try_new_in(x, MallocAllocator::new()) MallocBox::<T>::try_new_in(x, MallocAllocator::new())

View File

@@ -40,6 +40,7 @@ pub type MemfdSecVec<T> = allocator_api2::vec::Vec<T, MemfdSecAllocator>;
/// # assert_eq!(*memfdsec_box, 42u8); /// # assert_eq!(*memfdsec_box, 42u8);
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// # let _ = do_test();
/// ``` /// ```
pub fn memfdsec_box_try<T>(x: T) -> Result<MemfdSecBox<T>, AllocError> { pub fn memfdsec_box_try<T>(x: T) -> Result<MemfdSecBox<T>, AllocError> {
MemfdSecBox::<T>::try_new_in(x, MemfdSecAllocator::new()) MemfdSecBox::<T>::try_new_in(x, MemfdSecAllocator::new())

View File

@@ -38,6 +38,7 @@ static ALLOC_TYPE: OnceLock<SecretAllocType> = OnceLock::new();
/// } /// }
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// # let _ = do_test();
/// ``` /// ```
pub fn set_secret_alloc_type(alloc_type: SecretAllocType) { pub fn set_secret_alloc_type(alloc_type: SecretAllocType) {
ALLOC_TYPE.set(alloc_type).unwrap(); ALLOC_TYPE.set(alloc_type).unwrap();
@@ -135,6 +136,7 @@ pub type SecretVec<T> = allocator_api2::vec::Vec<T, SecretAlloc>;
/// # assert_eq!(*secret_box, 42u8); /// # assert_eq!(*secret_box, 42u8);
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// # let _ = do_test();
/// ``` /// ```
pub fn secret_box_try<T>(x: T) -> Result<SecretBox<T>, AllocError> { pub fn secret_box_try<T>(x: T) -> Result<SecretBox<T>, AllocError> {
SecretBox::<T>::try_new_in(x, SecretAlloc::default()) SecretBox::<T>::try_new_in(x, SecretAlloc::default())