History

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.

Miguel Ojeda committed 3 years ago

Commit ed615fb1 parent bfa7dff1 file · +3 −3Browse files

Showing the changes to rust/kernel (1 of 1 file). Show all

Unified · Split

rust/kernel/types.rs+3−3
@@ -109,7 +109,7 @@ impl ForeignOwnable for () { · 108 unmodified lines
109109 /// In the example below, we have multiple exit paths and we want to log regardless of which one is
110110 /// taken:
111111 /// ```
112−/// # use kernel::ScopeGuard;
112+/// # use kernel::types::ScopeGuard;
113113 /// fn example1(arg: bool) {
114114 /// let _log = ScopeGuard::new(|| pr_info!("example1 completed\n"));
115115 ///
@@ -127,7 +127,7 @@ impl ForeignOwnable for () { · 11 unmodified lines
127127 /// In the example below, we want to log the same message on all early exits but a different one on
128128 /// the main exit path:
129129 /// ```
130−/// # use kernel::ScopeGuard;
130+/// # use kernel::types::ScopeGuard;
131131 /// fn example2(arg: bool) {
132132 /// let log = ScopeGuard::new(|| pr_info!("example2 returned early\n"));
133133 ///
@@ -148,7 +148,7 @@ impl ForeignOwnable for () { · 14 unmodified lines
148148 /// In the example below, we need a mutable object (the vector) to be accessible within the log
149149 /// function, so we wrap it in the [`ScopeGuard`]:
150150 /// ```
151−/// # use kernel::ScopeGuard;
151+/// # use kernel::types::ScopeGuard;
152152 /// fn example3(arg: bool) -> Result {
153153 /// let mut vec =
154154 /// ScopeGuard::new_with_data(Vec::new(), |v| pr_info!("vec had {} elements\n", v.len()));