Skip to content

Commit 4c62348

Browse files
Valentin Obstojeda
authored andcommitted
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>
1 parent 8cfce47 commit 4c62348

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rust/kernel/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ impl CStr {
191191
/// ```
192192
/// # use kernel::c_str;
193193
/// # use kernel::str::CStr;
194+
/// let bar = c_str!("ツ");
194195
/// // SAFETY: String literals are guaranteed to be valid UTF-8
195196
/// // by the Rust compiler.
196-
/// let bar = c_str!("ツ");
197197
/// assert_eq!(unsafe { bar.as_str_unchecked() }, "ツ");
198198
/// ```
199199
#[inline]

0 commit comments

Comments
 (0)