Skip to content

Commit

Permalink
Remove unnecessary casts
Browse files Browse the repository at this point in the history
  • Loading branch information
clemenswasser committed Feb 5, 2022
1 parent 79b4469 commit 23b7663
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/platform_impl/windows/util.rs
Expand Up @@ -12,7 +12,7 @@ use std::{
use windows_sys::{
core::HRESULT,
Win32::{
Foundation::{BOOL, HWND, PSTR, PWSTR, RECT},
Foundation::{BOOL, HWND, PWSTR, RECT},
Graphics::Gdi::{ClientToScreen, InvalidateRgn, HMONITOR},
System::LibraryLoader::{GetProcAddress, LoadLibraryA},
UI::{
Expand Down Expand Up @@ -233,13 +233,12 @@ pub(super) fn get_function_impl(library: &str, function: &str) -> Option<*const
assert_eq!(function.chars().last(), Some('\0'));

// Library names we will use are ASCII so we can use the A version to avoid string conversion.
let module = unsafe { LoadLibraryA(library.as_ptr() as PSTR) };
let module = unsafe { LoadLibraryA(library.as_ptr()) };
if module == 0 {
return None;
}

unsafe { GetProcAddress(module, function.as_ptr() as PSTR) }
.map(|function_ptr| function_ptr as _)
unsafe { GetProcAddress(module, function.as_ptr()) }.map(|function_ptr| function_ptr as _)
}

macro_rules! get_function {
Expand Down

0 comments on commit 23b7663

Please sign in to comment.