Skip to content

Commit 58e1959

Browse files
ojedafbq
authored andcommitted
rust: types: make doctests compilable/testable
Rust documentation tests are going to be build/run-tested with the KUnit integration added in a future patch, thus update them to make them compilable/testable so that we may start enforcing it. Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: David Gow <davidgow@google.com> Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20230718052752.1045248-6-ojeda@kernel.org
1 parent d187f0b commit 58e1959

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rust/kernel/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl ForeignOwnable for () {
9191
/// In the example below, we have multiple exit paths and we want to log regardless of which one is
9292
/// taken:
9393
/// ```
94-
/// # use kernel::ScopeGuard;
94+
/// # use kernel::types::ScopeGuard;
9595
/// fn example1(arg: bool) {
9696
/// let _log = ScopeGuard::new(|| pr_info!("example1 completed\n"));
9797
///
@@ -109,7 +109,7 @@ impl ForeignOwnable for () {
109109
/// In the example below, we want to log the same message on all early exits but a different one on
110110
/// the main exit path:
111111
/// ```
112-
/// # use kernel::ScopeGuard;
112+
/// # use kernel::types::ScopeGuard;
113113
/// fn example2(arg: bool) {
114114
/// let log = ScopeGuard::new(|| pr_info!("example2 returned early\n"));
115115
///
@@ -130,7 +130,7 @@ impl ForeignOwnable for () {
130130
/// In the example below, we need a mutable object (the vector) to be accessible within the log
131131
/// function, so we wrap it in the [`ScopeGuard`]:
132132
/// ```
133-
/// # use kernel::ScopeGuard;
133+
/// # use kernel::types::ScopeGuard;
134134
/// fn example3(arg: bool) -> Result {
135135
/// let mut vec =
136136
/// ScopeGuard::new_with_data(Vec::new(), |v| pr_info!("vec had {} elements\n", v.len()));

0 commit comments

Comments
 (0)