Skip to content

Commit 8333ff4

Browse files
committed
rust: rbtree: fix SAFETY comments that should be # Safety sections
The tag `SAFETY` is used for safety comments, i.e. `// SAFETY`, while a `Safety` section is used for safety preconditions in code documentation, i.e. `/// # Safety`. Fix the three instances recently added in `rbtree` that Clippy would have normally caught in a public item, so that we can enable checking of private items in one of the following commits. Fixes: 98c14e4 ("rust: rbtree: add cursor") Reviewed-by: Trevor Gross <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Tested-by: Gary Guo <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8577c9d commit 8333ff4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rust/kernel/rbtree.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,8 @@ impl<'a, K, V> Cursor<'a, K, V> {
884884
NonNull::new(neighbor)
885885
}
886886

887-
/// SAFETY:
887+
/// # Safety
888+
///
888889
/// - `node` must be a valid pointer to a node in an [`RBTree`].
889890
/// - The caller has immutable access to `node` for the duration of 'b.
890891
unsafe fn to_key_value<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b V) {
@@ -894,7 +895,8 @@ impl<'a, K, V> Cursor<'a, K, V> {
894895
(k, unsafe { &*v })
895896
}
896897

897-
/// SAFETY:
898+
/// # Safety
899+
///
898900
/// - `node` must be a valid pointer to a node in an [`RBTree`].
899901
/// - The caller has mutable access to `node` for the duration of 'b.
900902
unsafe fn to_key_value_mut<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b mut V) {
@@ -904,7 +906,8 @@ impl<'a, K, V> Cursor<'a, K, V> {
904906
(k, unsafe { &mut *v })
905907
}
906908

907-
/// SAFETY:
909+
/// # Safety
910+
///
908911
/// - `node` must be a valid pointer to a node in an [`RBTree`].
909912
/// - The caller has immutable access to the key for the duration of 'b.
910913
unsafe fn to_key_value_raw<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, *mut V) {

0 commit comments

Comments
 (0)