Skip to content

Commit 7100e46

Browse files
committed
rust: rbtree: simplify examples
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent ed81420 commit 7100e46

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

rust/kernel/rbtree.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ struct Node<K, V> {
3939
/// ```
4040
/// use kernel::rbtree::RBTree;
4141
///
42-
/// # fn test() -> Result {
4342
/// // Create a new tree.
4443
/// let mut tree = RBTree::new();
4544
///
@@ -110,10 +109,7 @@ struct Node<K, V> {
110109
/// assert!(iter.next().is_none());
111110
/// }
112111
///
113-
/// # Ok(())
114-
/// # }
115-
/// #
116-
/// # assert_eq!(test(), Ok(()));
112+
/// # Ok::<(), Error>(())
117113
/// ```
118114
///
119115
/// In the example below, we first allocate a node, acquire a spinlock, then insert the node into
@@ -140,7 +136,6 @@ struct Node<K, V> {
140136
/// ```
141137
/// use kernel::rbtree::RBTree;
142138
///
143-
/// # fn test() -> Result {
144139
/// // Create a new tree.
145140
/// let mut tree = RBTree::new();
146141
///
@@ -185,10 +180,7 @@ struct Node<K, V> {
185180
/// assert!(iter.next().is_none());
186181
/// }
187182
///
188-
/// # Ok(())
189-
/// # }
190-
/// #
191-
/// # assert_eq!(test(), Ok(()));
183+
/// # Ok::<(), Error>(())
192184
/// ```
193185
pub struct RBTree<K, V> {
194186
root: bindings::rb_root,

0 commit comments

Comments
 (0)