Skip to content

Commit a4c1d08

Browse files
wutchzonejannau
authored andcommitted
rust: page: remove unnecessary helper function from doctest
Doctests in `page.rs` contained a helper function `dox` which acted as a wrapper for using the `?` operator. However, this is not needed because doctests are implicitly wrapped in function see [1]. Link: https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#using--in-doc-tests [1] Suggested-by: Dirk Behme <[email protected]> Suggested-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/rust-for-linux/[email protected]/ Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Signed-off-by: Daniel Sedlak <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Fixed typo in SoB. Slightly reworded commit. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent bc564d9 commit a4c1d08

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

rust/kernel/page.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,17 @@ impl Page {
5757
/// ```
5858
/// use kernel::page::Page;
5959
///
60-
/// # fn dox() -> Result<(), kernel::alloc::AllocError> {
6160
/// let page = Page::alloc_page(GFP_KERNEL)?;
62-
/// # Ok(()) }
61+
/// # Ok::<(), kernel::alloc::AllocError>(())
6362
/// ```
6463
///
6564
/// Allocate memory for a page and zero its contents.
6665
///
6766
/// ```
6867
/// use kernel::page::Page;
6968
///
70-
/// # fn dox() -> Result<(), kernel::alloc::AllocError> {
7169
/// let page = Page::alloc_page(GFP_KERNEL | __GFP_ZERO)?;
72-
/// # Ok(()) }
70+
/// # Ok::<(), kernel::alloc::AllocError>(())
7371
/// ```
7472
pub fn alloc_page(flags: Flags) -> Result<Self, AllocError> {
7573
// SAFETY: Depending on the value of `gfp_flags`, this call may sleep. Other than that, it

0 commit comments

Comments
 (0)