Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Miguel Ojeda and committed by
Shuah Khan
ed615fb8 bfa7dff0

+3 -3
+3 -3
rust/kernel/types.rs
··· 109 109 /// In the example below, we have multiple exit paths and we want to log regardless of which one is 110 110 /// taken: 111 111 /// ``` 112 - /// # use kernel::ScopeGuard; 112 + /// # use kernel::types::ScopeGuard; 113 113 /// fn example1(arg: bool) { 114 114 /// let _log = ScopeGuard::new(|| pr_info!("example1 completed\n")); 115 115 /// ··· 127 127 /// In the example below, we want to log the same message on all early exits but a different one on 128 128 /// the main exit path: 129 129 /// ``` 130 - /// # use kernel::ScopeGuard; 130 + /// # use kernel::types::ScopeGuard; 131 131 /// fn example2(arg: bool) { 132 132 /// let log = ScopeGuard::new(|| pr_info!("example2 returned early\n")); 133 133 /// ··· 148 148 /// In the example below, we need a mutable object (the vector) to be accessible within the log 149 149 /// function, so we wrap it in the [`ScopeGuard`]: 150 150 /// ``` 151 - /// # use kernel::ScopeGuard; 151 + /// # use kernel::types::ScopeGuard; 152 152 /// fn example3(arg: bool) -> Result { 153 153 /// let mut vec = 154 154 /// ScopeGuard::new_with_data(Vec::new(), |v| pr_info!("vec had {} elements\n", v.len()));