Skip to content

Commit 1b9057e

Browse files
committed
kernel/error: Make clippy::undocumented_unsafe_blocks happy
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent e94d0e8 commit 1b9057e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rust/kernel/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ impl fmt::Debug for Error {
274274
match self.name() {
275275
// Print out number if no name can be found.
276276
None => f.debug_tuple("Error").field(&-self.0).finish(),
277-
// SAFETY: These strings are ASCII-only.
278277
Some(name) => f
278+
// SAFETY: These strings are ASCII-only.
279279
.debug_tuple(unsafe { core::str::from_utf8_unchecked(name) })
280280
.finish(),
281281
}
@@ -386,6 +386,7 @@ pub(crate) fn from_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
386386
if unsafe { bindings::IS_ERR(const_ptr) } {
387387
// SAFETY: The FFI function does not deref the pointer.
388388
let err = unsafe { bindings::PTR_ERR(const_ptr) };
389+
#[allow(clippy::unnecessary_cast)]
389390
// CAST: If `IS_ERR()` returns `true`,
390391
// then `PTR_ERR()` is guaranteed to return a
391392
// negative value greater-or-equal to `-bindings::MAX_ERRNO`,
@@ -395,7 +396,6 @@ pub(crate) fn from_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
395396
//
396397
// SAFETY: `IS_ERR()` ensures `err` is a
397398
// negative value greater-or-equal to `-bindings::MAX_ERRNO`.
398-
#[allow(clippy::unnecessary_cast)]
399399
return Err(unsafe { Error::from_errno_unchecked(err as core::ffi::c_int) });
400400
}
401401
Ok(ptr)

0 commit comments

Comments
 (0)