Skip to content

Commit 02b0e09

Browse files
committed
deny clippy::undocumented_unsafe_blocks
needs a workaround for rust-lang/rust-clippy#10832
1 parent 74145bb commit 02b0e09

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

wdf-kmdf/src/lib.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Rust KMDF Abstractions
22
#![no_std]
3-
#![deny(unsafe_op_in_unsafe_fn)]
3+
#![deny(unsafe_op_in_unsafe_fn, clippy::undocumented_unsafe_blocks)]
44

55
pub mod raw {
66
//! Raw bindings to KMDF functions
@@ -703,8 +703,10 @@ pub mod object {
703703
let handle = handle.as_handle();
704704

705705
// SAFETY: `handle` validity assured by `AsObjectHandle`, and context info validity assured by `IntoContextSpace`
706-
let context_space =
707-
unsafe { crate::raw::WdfObjectGetTypedContextWorker(handle, T::CONTEXT_INFO) };
706+
let context_space = unsafe {
707+
// filler line as a work-around for https://github.com/rust-lang/rust-clippy/issues/10832
708+
crate::raw::WdfObjectGetTypedContextWorker(handle, T::CONTEXT_INFO)
709+
};
708710
let context_space = context_space.cast::<T>();
709711

710712
// SAFETY:
@@ -726,8 +728,10 @@ pub mod object {
726728
let handle = handle.as_handle_mut();
727729

728730
// SAFETY: `handle` validity assured by `AsObjectHandle`, and context info validity assured by `IntoContextSpace`
729-
let context_space =
730-
unsafe { crate::raw::WdfObjectGetTypedContextWorker(handle, T::CONTEXT_INFO) };
731+
let context_space = unsafe {
732+
// filler line as a work-around for https://github.com/rust-lang/rust-clippy/issues/10832
733+
crate::raw::WdfObjectGetTypedContextWorker(handle, T::CONTEXT_INFO)
734+
};
731735
let context_space = context_space.cast::<T>();
732736

733737
// SAFETY:
@@ -752,8 +756,10 @@ pub mod object {
752756
let handle = handle.as_handle_mut();
753757

754758
// SAFETY: `handle` validity assured by `AsObjectHandle`, and context info validity assured by `IntoContextSpace`
755-
let context_space =
756-
unsafe { crate::raw::WdfObjectGetTypedContextWorker(handle, T::CONTEXT_INFO) };
759+
let context_space = unsafe {
760+
// filler line as a work-around for https://github.com/rust-lang/rust-clippy/issues/10832
761+
crate::raw::WdfObjectGetTypedContextWorker(handle, T::CONTEXT_INFO)
762+
};
757763
let context_space = context_space.cast::<T>();
758764

759765
// SAFETY:
@@ -794,7 +800,7 @@ pub mod driver {
794800
impl DriverHandle {
795801
/// Wraps the handle in a raw driver object
796802
///
797-
/// SAFETY:
803+
/// ## Safety
798804
///
799805
/// Respect aliasing rules, since this can be used to
800806
/// generate aliasing mutable references to the context space
@@ -997,13 +1003,9 @@ pub mod driver {
9971003
return;
9981004
};
9991005

1000-
unsafe {
1001-
windows_kernel_sys::DbgPrintEx(
1002-
windows_kernel_sys::_DPFLTR_TYPE::DPFLTR_IHVDRIVER_ID as u32,
1003-
windows_kernel_sys::DPFLTR_INFO_LEVEL,
1004-
b"KmdfHewwoWowwd: EvtDestroy\n\0".as_ptr().cast(),
1005-
)
1006-
};
1006+
// Don't really need it here, but just as a demonstration of how we can add logging
1007+
// for lib crates
1008+
windows_kernel_rs::log::debug!("KmdfHewwoWowwd: EvtDestroy");
10071009

10081010
// Drop it!
10091011
// SAFETY:

0 commit comments

Comments
 (0)