Skip to content

Commit 6a11ce7

Browse files
committed
kernel/error: Make clippy::undocumented_unsafe_blocks happy
Signed-off-by: Asahi Lina <[email protected]>
1 parent 4428e79 commit 6a11ce7

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
}
@@ -390,6 +390,7 @@ pub(crate) fn from_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
390390
if unsafe { bindings::IS_ERR(const_ptr) } {
391391
// SAFETY: The FFI function does not deref the pointer.
392392
let err = unsafe { bindings::PTR_ERR(const_ptr) };
393+
#[allow(clippy::unnecessary_cast)]
393394
// CAST: If `IS_ERR()` returns `true`,
394395
// then `PTR_ERR()` is guaranteed to return a
395396
// negative value greater-or-equal to `-bindings::MAX_ERRNO`,
@@ -399,7 +400,6 @@ pub(crate) fn from_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
399400
//
400401
// SAFETY: `IS_ERR()` ensures `err` is a
401402
// negative value greater-or-equal to `-bindings::MAX_ERRNO`.
402-
#[allow(clippy::unnecessary_cast)]
403403
return Err(unsafe { Error::from_errno_unchecked(err as core::ffi::c_int) });
404404
}
405405
Ok(ptr)

0 commit comments

Comments
 (0)