Move safety comment outside unsafe block

This commit is contained in:
Chris Denton 2024-07-15 07:30:11 +00:00
parent 3411a025d5
commit 7e16d5fb61
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -111,8 +111,8 @@ impl Module {
/// This should only be use for modules that exist for the lifetime of std
/// (e.g. kernel32 and ntdll).
pub unsafe fn new(name: &CStr) -> Option<Self> {
unsafe {
// SAFETY: A CStr is always null terminated.
unsafe {
let module = c::GetModuleHandleA(name.as_ptr().cast::<u8>());
NonNull::new(module).map(Self)
}