Skip to content

Commit 4ed4b09

Browse files
wutchzoneojeda
authored andcommitted
rust: kernel: 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 <dirk.behme@de.bosch.com> Suggested-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/rust-for-linux/459782fe-afca-4fe6-8ffb-ba7c7886de0a@de.bosch.com/ Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Daniel Sedlak <daniel@sedlak.dev> Link: https://lore.kernel.org/r/20241123095033.41240-4-daniel@sedlak.dev [ Fixed typo in SoB. Slightly reworded commit. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent f1f5221 commit 4ed4b09

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)