From c3a6d1c93cfa22f21a45fc085eb589576e1fdafd Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 30 Nov 2025 15:06:33 +0300 Subject: [PATCH] treewide: fix commonmark formatting in Rustdoc Signed-off-by: NotAShelf Change-Id: Ie1a13221aded56f903156fdb35abe2ac6a6a6964 --- src/lib.rs | 3 ++- src/syscall.rs | 11 +++++++++-- src/uptime.rs | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8c8a6ba..1e0f9f3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,8 @@ impl UtsName { /// Calls `uname` syscall and returns a `UtsName` wrapper /// /// # Errors - /// Returns an error if the uname syscall fails + /// + /// Returns an error if the `uname` syscall fails pub fn uname() -> Result { let mut uts = MaybeUninit::uninit(); if unsafe { libc::uname(uts.as_mut_ptr()) } != 0 { diff --git a/src/syscall.rs b/src/syscall.rs index 2776fe7..0c8634b 100644 --- a/src/syscall.rs +++ b/src/syscall.rs @@ -11,11 +11,15 @@ use std::io; /// Direct syscall to open a file -/// Returns file descriptor or -1 on error +/// +/// # Returns +/// +/// File descriptor or -1 on error /// /// # Safety /// /// The caller must ensure: +/// /// - `path` points to a valid null-terminated C string /// - The pointer remains valid for the duration of the syscall #[inline] @@ -65,7 +69,10 @@ pub unsafe fn sys_open(path: *const u8, flags: i32) -> i32 { } /// Direct syscall to read from a file descriptor -/// Returns number of bytes read or -1 on error +/// +/// # Returns n +/// +/// Number of bytes read or -1 on error /// /// # Safety /// diff --git a/src/uptime.rs b/src/uptime.rs index 98c9207..095af7d 100644 --- a/src/uptime.rs +++ b/src/uptime.rs @@ -1,6 +1,6 @@ use std::{io, mem::MaybeUninit}; -/// Fast integer to string conversion (no formatting overhead) +/// Faster integer to string conversion without the formatting overhead. #[inline] fn itoa(mut n: u64, buf: &mut [u8]) -> &str { if n == 0 { @@ -17,9 +17,10 @@ fn itoa(mut n: u64, buf: &mut [u8]) -> &str { unsafe { std::str::from_utf8_unchecked(&buf[i..]) } } -/// Direct sysinfo syscall using inline assembly +/// Direct `sysinfo` syscall using inline assembly /// /// # Safety +/// /// This function uses inline assembly to make a direct syscall. /// The caller must ensure the sysinfo pointer is valid. #[inline]