Skip to content

Commit fc0f018

Browse files
adamrkojeda
andauthored
comment formatting
Co-authored-by: Miguel Ojeda <[email protected]>
1 parent e47fac7 commit fc0f018

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

rust/kernel/c_types.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ pub use c::*;
5454

5555
/// Reads string until null byte is reached and returns slice excluding the terminating null.
5656
///
57-
/// SAFETY: The data from the pointer until the null terminator must be valid for reads and
58-
/// not mutated for all of `'a`. The length of the string must also be less than `isize::MAX`.
59-
/// See the documentation on [`from_raw_parts`](https://doc.rust-lang.org/core/slice/fn.from_raw_parts.html)
60-
/// for further details on safety of converting a pointer to a slice.
57+
/// # Safety
58+
///
59+
/// The data from the pointer until the null terminator must be valid for reads
60+
/// and not mutated for all of `'a`. The length of the string must also be less
61+
/// than `isize::MAX`. See the documentation on [`from_raw_parts`] for further
62+
/// details on safety of converting a pointer to a slice.
63+
///
64+
/// [`from_raw_parts`]: https://doc.rust-lang.org/core/slice/fn.from_raw_parts.html
6165
pub unsafe fn c_string_bytes<'a>(ptr: *const crate::c_types::c_char) -> &'a [u8] {
6266
let length = crate::bindings::strlen(ptr) as usize;
6367
&core::slice::from_raw_parts(ptr as *const u8, length)

0 commit comments

Comments
 (0)