]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: page: remove unnecessary helper function from doctest
authorDaniel Sedlak <daniel@sedlak.dev>
Sat, 23 Nov 2024 09:50:30 +0000 (10:50 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 13 Jan 2025 22:44:55 +0000 (23:44 +0100)
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
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>
rust/kernel/page.rs

index fdac6c375fe46e1ba589f1640afeae3e001e39ae..f6126aca33a681f656492d1f0a13a687264852c3 100644 (file)
@@ -57,9 +57,8 @@ impl Page {
     /// ```
     /// use kernel::page::Page;
     ///
-    /// # fn dox() -> Result<(), kernel::alloc::AllocError> {
     /// let page = Page::alloc_page(GFP_KERNEL)?;
-    /// # Ok(()) }
+    /// # Ok::<(), kernel::alloc::AllocError>(())
     /// ```
     ///
     /// Allocate memory for a page and zero its contents.
@@ -67,9 +66,8 @@ impl Page {
     /// ```
     /// use kernel::page::Page;
     ///
-    /// # fn dox() -> Result<(), kernel::alloc::AllocError> {
     /// let page = Page::alloc_page(GFP_KERNEL | __GFP_ZERO)?;
-    /// # Ok(()) }
+    /// # Ok::<(), kernel::alloc::AllocError>(())
     /// ```
     pub fn alloc_page(flags: Flags) -> Result<Self, AllocError> {
         // SAFETY: Depending on the value of `gfp_flags`, this call may sleep. Other than that, it