summaryrefslogtreecommitdiffstats
path: root/rust/kernel/str.rs
diff options
context:
space:
mode:
authorValentin Obst <kernel@valentinobst.de>2024-01-31 21:23:28 +0100
committerMiguel Ojeda <ojeda@kernel.org>2024-02-18 21:22:27 +0100
commit4c62348d5b845c9acb82378faf5aefdcb06c38be (patch)
treebec6a4d331383a8b767a760f3eb786151d214f26 /rust/kernel/str.rs
parentrust: str: use `NUL` instead of 0 in doc comments (diff)
downloadlinux-4c62348d5b845c9acb82378faf5aefdcb06c38be.tar.xz
linux-4c62348d5b845c9acb82378faf5aefdcb06c38be.zip
rust: str: move SAFETY comment in front of unsafe block
SAFETY comments should immediately precede the unsafe block they justify. Move assignment to `bar` past comment as it is safe. Signed-off-by: Valentin Obst <kernel@valentinobst.de> Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240131-doc-fixes-v3-v3-6-0c8af94ed7de@valentinobst.de Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/str.rs')
-rw-r--r--rust/kernel/str.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
index 843ffeec9b3e..fec5c4314758 100644
--- a/rust/kernel/str.rs
+++ b/rust/kernel/str.rs
@@ -191,9 +191,9 @@ impl CStr {
/// ```
/// # use kernel::c_str;
/// # use kernel::str::CStr;
+ /// let bar = c_str!("ツ");
/// // SAFETY: String literals are guaranteed to be valid UTF-8
/// // by the Rust compiler.
- /// let bar = c_str!("ツ");
/// assert_eq!(unsafe { bar.as_str_unchecked() }, "ツ");
/// ```
#[inline]