From 9f5ec21529ec0530ac16e9a1c5d16eb8bb290535 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Tue, 27 Aug 2024 16:04:19 -0500 Subject: [PATCH] Remove unnecessary closure from generated code (#3228) --- crates/libs/bindgen/src/rust/functions.rs | 2 +- .../src/Windows/Win32/Devices/AllJoyn/mod.rs | 2 +- .../Windows/Win32/Devices/Bluetooth/mod.rs | 4 +- .../DeviceAndDriverInstallation/mod.rs | 32 +++--- .../src/Windows/Win32/Foundation/mod.rs | 2 +- .../src/Windows/Win32/Graphics/Gdi/mod.rs | 2 +- .../src/Windows/Win32/Graphics/OpenGL/mod.rs | 4 +- .../Windows/Win32/Graphics/Printing/mod.rs | 6 +- .../Win32/NetworkManagement/IpHelper/mod.rs | 4 +- .../Win32/Networking/Clustering/mod.rs | 14 +-- .../Windows/Win32/Networking/WinInet/mod.rs | 14 +-- .../Windows/Win32/Networking/WinSock/mod.rs | 26 ++--- .../Win32/Security/Authorization/UI/mod.rs | 2 +- .../Windows/Win32/Security/Credentials/mod.rs | 2 +- .../Win32/Security/Cryptography/mod.rs | 10 +- .../Windows/Win32/Storage/FileSystem/mod.rs | 66 +++++------ .../mod.rs | 4 +- .../src/Windows/Win32/System/Console/mod.rs | 4 +- .../Windows/Win32/System/DataExchange/mod.rs | 12 +- .../Win32/System/Diagnostics/Debug/mod.rs | 20 ++-- .../Win32/System/Diagnostics/ToolHelp/mod.rs | 2 +- .../src/Windows/Win32/System/EventLog/mod.rs | 36 +++--- .../Windows/Win32/System/GroupPolicy/mod.rs | 2 +- .../src/Windows/Win32/System/IO/mod.rs | 2 +- .../Windows/Win32/System/JobObjects/mod.rs | 8 +- .../Windows/Win32/System/LibraryLoader/mod.rs | 24 ++-- .../src/Windows/Win32/System/Mailslots/mod.rs | 4 +- .../src/Windows/Win32/System/Memory/mod.rs | 36 +++--- .../src/Windows/Win32/System/Ole/mod.rs | 2 +- .../src/Windows/Win32/System/Pipes/mod.rs | 2 +- .../src/Windows/Win32/System/Power/mod.rs | 6 +- .../Windows/Win32/System/RemoteDesktop/mod.rs | 4 +- .../src/Windows/Win32/System/Services/mod.rs | 20 ++-- .../Win32/System/StationsAndDesktops/mod.rs | 26 ++--- .../src/Windows/Win32/System/Threading/mod.rs | 74 ++++++------- .../src/Windows/Win32/UI/Controls/mod.rs | 10 +- .../Win32/UI/Input/KeyboardAndMouse/mod.rs | 10 +- .../Win32/UI/WindowsAndMessaging/mod.rs | 104 +++++++++--------- 38 files changed, 302 insertions(+), 302 deletions(-) diff --git a/crates/libs/bindgen/src/rust/functions.rs b/crates/libs/bindgen/src/rust/functions.rs index 5d36295f96..e0c68ebb2a 100644 --- a/crates/libs/bindgen/src/rust/functions.rs +++ b/crates/libs/bindgen/src/rust/functions.rs @@ -167,7 +167,7 @@ fn gen_win_function(writer: &Writer, namespace: &str, def: metadata::MethodDef) pub unsafe fn #name<#generics>(#params) -> windows_core::Result<#return_type> #where_clause { #link let result__ = #name(#args); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } } } else { diff --git a/crates/libs/windows/src/Windows/Win32/Devices/AllJoyn/mod.rs b/crates/libs/windows/src/Windows/Win32/Devices/AllJoyn/mod.rs index ccd17affc7..2f40455d8c 100644 --- a/crates/libs/windows/src/Windows/Win32/Devices/AllJoyn/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Devices/AllJoyn/mod.rs @@ -22,7 +22,7 @@ where { windows_targets::link!("msajapi.dll" "system" fn AllJoynConnectToBus(connectionspec : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = AllJoynConnectToBus(connectionspec.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] diff --git a/crates/libs/windows/src/Windows/Win32/Devices/Bluetooth/mod.rs b/crates/libs/windows/src/Windows/Win32/Devices/Bluetooth/mod.rs index fc538a6ecd..d8ac0db6dc 100644 --- a/crates/libs/windows/src/Windows/Win32/Devices/Bluetooth/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Devices/Bluetooth/mod.rs @@ -71,13 +71,13 @@ where pub unsafe fn BluetoothFindFirstDevice(pbtsp: *const BLUETOOTH_DEVICE_SEARCH_PARAMS, pbtdi: *mut BLUETOOTH_DEVICE_INFO) -> windows_core::Result { windows_targets::link!("bluetoothapis.dll" "system" fn BluetoothFindFirstDevice(pbtsp : *const BLUETOOTH_DEVICE_SEARCH_PARAMS, pbtdi : *mut BLUETOOTH_DEVICE_INFO) -> HBLUETOOTH_DEVICE_FIND); let result__ = BluetoothFindFirstDevice(pbtsp, pbtdi); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn BluetoothFindFirstRadio(pbtfrp: *const BLUETOOTH_FIND_RADIO_PARAMS, phradio: *mut super::super::Foundation::HANDLE) -> windows_core::Result { windows_targets::link!("bluetoothapis.dll" "system" fn BluetoothFindFirstRadio(pbtfrp : *const BLUETOOTH_FIND_RADIO_PARAMS, phradio : *mut super::super::Foundation:: HANDLE) -> HBLUETOOTH_RADIO_FIND); let result__ = BluetoothFindFirstRadio(pbtfrp, phradio); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn BluetoothFindNextDevice(hfind: P0, pbtdi: *mut BLUETOOTH_DEVICE_INFO) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/Devices/DeviceAndDriverInstallation/mod.rs b/crates/libs/windows/src/Windows/Win32/Devices/DeviceAndDriverInstallation/mod.rs index db5fc36e8d..fe9da2e114 100644 --- a/crates/libs/windows/src/Windows/Win32/Devices/DeviceAndDriverInstallation/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Devices/DeviceAndDriverInstallation/mod.rs @@ -1889,7 +1889,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDevRegKeyA(deviceinfoset : HDEVINFO, deviceinfodata : *const SP_DEVINFO_DATA, scope : u32, hwprofile : u32, keytype : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCSTR) -> super::super::System::Registry:: HKEY); let result__ = SetupDiCreateDevRegKeyA(deviceinfoset.param().abi(), deviceinfodata, scope, hwprofile, keytype, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Registry")] #[inline] @@ -1900,7 +1900,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDevRegKeyW(deviceinfoset : HDEVINFO, deviceinfodata : *const SP_DEVINFO_DATA, scope : u32, hwprofile : u32, keytype : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCWSTR) -> super::super::System::Registry:: HKEY); let result__ = SetupDiCreateDevRegKeyW(deviceinfoset.param().abi(), deviceinfodata, scope, hwprofile, keytype, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiCreateDeviceInfoA(deviceinfoset: P0, devicename: P1, classguid: *const windows_core::GUID, devicedescription: P2, hwndparent: P3, creationflags: SETUP_DI_DEVICE_CREATION_FLAGS, deviceinfodata: Option<*mut SP_DEVINFO_DATA>) -> windows_core::Result<()> @@ -1920,7 +1920,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInfoList(classguid : *const windows_core::GUID, hwndparent : super::super::Foundation:: HWND) -> HDEVINFO); let result__ = SetupDiCreateDeviceInfoList(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), hwndparent.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiCreateDeviceInfoListExA(classguid: Option<*const windows_core::GUID>, hwndparent: P0, machinename: P1, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -1930,7 +1930,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInfoListExA(classguid : *const windows_core::GUID, hwndparent : super::super::Foundation:: HWND, machinename : windows_core::PCSTR, reserved : *const core::ffi::c_void) -> HDEVINFO); let result__ = SetupDiCreateDeviceInfoListExA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), hwndparent.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiCreateDeviceInfoListExW(classguid: Option<*const windows_core::GUID>, hwndparent: P0, machinename: P1, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -1940,7 +1940,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInfoListExW(classguid : *const windows_core::GUID, hwndparent : super::super::Foundation:: HWND, machinename : windows_core::PCWSTR, reserved : *const core::ffi::c_void) -> HDEVINFO); let result__ = SetupDiCreateDeviceInfoListExW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), hwndparent.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiCreateDeviceInfoW(deviceinfoset: P0, devicename: P1, classguid: *const windows_core::GUID, devicedescription: P2, hwndparent: P3, creationflags: SETUP_DI_DEVICE_CREATION_FLAGS, deviceinfodata: Option<*mut SP_DEVINFO_DATA>) -> windows_core::Result<()> @@ -1971,7 +1971,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInterfaceRegKeyA(deviceinfoset : HDEVINFO, deviceinterfacedata : *const SP_DEVICE_INTERFACE_DATA, reserved : u32, samdesired : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCSTR) -> super::super::System::Registry:: HKEY); let result__ = SetupDiCreateDeviceInterfaceRegKeyA(deviceinfoset.param().abi(), deviceinterfacedata, reserved, samdesired, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Registry")] #[inline] @@ -1982,7 +1982,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInterfaceRegKeyW(deviceinfoset : HDEVINFO, deviceinterfacedata : *const SP_DEVICE_INTERFACE_DATA, reserved : u32, samdesired : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCWSTR) -> super::super::System::Registry:: HKEY); let result__ = SetupDiCreateDeviceInterfaceRegKeyW(deviceinfoset.param().abi(), deviceinterfacedata, reserved, samdesired, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiCreateDeviceInterfaceW(deviceinfoset: P0, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const windows_core::GUID, referencestring: P1, creationflags: u32, deviceinterfacedata: Option<*mut SP_DEVICE_INTERFACE_DATA>) -> windows_core::Result<()> @@ -2211,7 +2211,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsA(classguid : *const windows_core::GUID, enumerator : windows_core::PCSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS) -> HDEVINFO); let result__ = SetupDiGetClassDevsA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiGetClassDevsExA(classguid: Option<*const windows_core::GUID>, enumerator: P0, hwndparent: P1, flags: SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset: P2, machinename: P3, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -2223,7 +2223,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsExA(classguid : *const windows_core::GUID, enumerator : windows_core::PCSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset : HDEVINFO, machinename : windows_core::PCSTR, reserved : *const core::ffi::c_void) -> HDEVINFO); let result__ = SetupDiGetClassDevsExA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags, deviceinfoset.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiGetClassDevsExW(classguid: Option<*const windows_core::GUID>, enumerator: P0, hwndparent: P1, flags: SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset: P2, machinename: P3, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -2235,7 +2235,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsExW(classguid : *const windows_core::GUID, enumerator : windows_core::PCWSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset : HDEVINFO, machinename : windows_core::PCWSTR, reserved : *const core::ffi::c_void) -> HDEVINFO); let result__ = SetupDiGetClassDevsExW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags, deviceinfoset.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiGetClassDevsW(classguid: Option<*const windows_core::GUID>, enumerator: P0, hwndparent: P1, flags: SETUP_DI_GET_CLASS_DEVS_FLAGS) -> windows_core::Result @@ -2245,7 +2245,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsW(classguid : *const windows_core::GUID, enumerator : windows_core::PCWSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS) -> HDEVINFO); let result__ = SetupDiGetClassDevsW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_UI_Controls")] #[inline] @@ -2697,7 +2697,7 @@ where pub unsafe fn SetupDiOpenClassRegKey(classguid: Option<*const windows_core::GUID>, samdesired: u32) -> windows_core::Result { windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenClassRegKey(classguid : *const windows_core::GUID, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = SetupDiOpenClassRegKey(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Registry")] #[inline] @@ -2707,7 +2707,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenClassRegKeyExA(classguid : *const windows_core::GUID, samdesired : u32, flags : u32, machinename : windows_core::PCSTR, reserved : *const core::ffi::c_void) -> super::super::System::Registry:: HKEY); let result__ = SetupDiOpenClassRegKeyExA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), samdesired, flags, machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Registry")] #[inline] @@ -2717,7 +2717,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenClassRegKeyExW(classguid : *const windows_core::GUID, samdesired : u32, flags : u32, machinename : windows_core::PCWSTR, reserved : *const core::ffi::c_void) -> super::super::System::Registry:: HKEY); let result__ = SetupDiOpenClassRegKeyExW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), samdesired, flags, machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Registry")] #[inline] @@ -2727,7 +2727,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenDevRegKey(deviceinfoset : HDEVINFO, deviceinfodata : *const SP_DEVINFO_DATA, scope : u32, hwprofile : u32, keytype : u32, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = SetupDiOpenDevRegKey(deviceinfoset.param().abi(), deviceinfodata, scope, hwprofile, keytype, samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiOpenDeviceInfoA(deviceinfoset: P0, deviceinstanceid: P1, hwndparent: P2, openflags: u32, deviceinfodata: Option<*mut SP_DEVINFO_DATA>) -> windows_core::Result<()> @@ -2766,7 +2766,7 @@ where { windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenDeviceInterfaceRegKey(deviceinfoset : HDEVINFO, deviceinterfacedata : *const SP_DEVICE_INTERFACE_DATA, reserved : u32, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = SetupDiOpenDeviceInterfaceRegKey(deviceinfoset.param().abi(), deviceinterfacedata, reserved, samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetupDiOpenDeviceInterfaceW(deviceinfoset: P0, devicepath: P1, openflags: u32, deviceinterfacedata: Option<*mut SP_DEVICE_INTERFACE_DATA>) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/Foundation/mod.rs b/crates/libs/windows/src/Windows/Win32/Foundation/mod.rs index 4a5ffe523d..1046f9dcbe 100644 --- a/crates/libs/windows/src/Windows/Win32/Foundation/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Foundation/mod.rs @@ -54,7 +54,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn GlobalFree(hmem : HGLOBAL) -> HGLOBAL); let result__ = GlobalFree(hmem.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LocalFree(hmem: P0) -> HLOCAL diff --git a/crates/libs/windows/src/Windows/Win32/Graphics/Gdi/mod.rs b/crates/libs/windows/src/Windows/Win32/Graphics/Gdi/mod.rs index 0a049ba53e..9485d98b68 100644 --- a/crates/libs/windows/src/Windows/Win32/Graphics/Gdi/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Graphics/Gdi/mod.rs @@ -313,7 +313,7 @@ where { windows_targets::link!("gdi32.dll" "system" fn CreateDIBSection(hdc : HDC, pbmi : *const BITMAPINFO, usage : DIB_USAGE, ppvbits : *mut *mut core::ffi::c_void, hsection : super::super::Foundation:: HANDLE, offset : u32) -> HBITMAP); let result__ = CreateDIBSection(hdc.param().abi(), pbmi, usage, ppvbits, hsection.param().abi(), offset); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateDIBitmap(hdc: P0, pbmih: Option<*const BITMAPINFOHEADER>, flinit: u32, pjbits: Option<*const core::ffi::c_void>, pbmi: Option<*const BITMAPINFO>, iusage: DIB_USAGE) -> HBITMAP diff --git a/crates/libs/windows/src/Windows/Win32/Graphics/OpenGL/mod.rs b/crates/libs/windows/src/Windows/Win32/Graphics/OpenGL/mod.rs index e5b5661358..c57a4012d5 100644 --- a/crates/libs/windows/src/Windows/Win32/Graphics/OpenGL/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Graphics/OpenGL/mod.rs @@ -2009,7 +2009,7 @@ where { windows_targets::link!("opengl32.dll" "system" fn wglCreateContext(param0 : super::Gdi:: HDC) -> HGLRC); let result__ = wglCreateContext(param0.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Graphics_Gdi")] #[inline] @@ -2019,7 +2019,7 @@ where { windows_targets::link!("opengl32.dll" "system" fn wglCreateLayerContext(param0 : super::Gdi:: HDC, param1 : i32) -> HGLRC); let result__ = wglCreateLayerContext(param0.param().abi(), param1); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn wglDeleteContext(param0: P0) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/Graphics/Printing/mod.rs b/crates/libs/windows/src/Windows/Win32/Graphics/Printing/mod.rs index 217531c908..4fd94dd7df 100644 --- a/crates/libs/windows/src/Windows/Win32/Graphics/Printing/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Graphics/Printing/mod.rs @@ -130,7 +130,7 @@ where { windows_targets::link!("winspool.drv" "system" fn AddPrinterA(pname : windows_core::PCSTR, level : u32, pprinter : *const u8) -> super::super::Foundation:: HANDLE); let result__ = AddPrinterA(pname.param().abi(), level, pprinter); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn AddPrinterConnection2A(hwnd: P0, pszname: P1, dwlevel: u32, pconnectioninfo: *const core::ffi::c_void) -> super::super::Foundation::BOOL @@ -205,7 +205,7 @@ where { windows_targets::link!("winspool.drv" "system" fn AddPrinterW(pname : windows_core::PCWSTR, level : u32, pprinter : *const u8) -> super::super::Foundation:: HANDLE); let result__ = AddPrinterW(pname.param().abi(), level, pprinter); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Graphics_Gdi")] #[inline] @@ -1295,7 +1295,7 @@ where { windows_targets::link!("winspool.drv" "system" fn GetSpoolFileHandle(hprinter : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = GetSpoolFileHandle(hprinter.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn ImpersonatePrinterClient(htoken: P0) -> super::super::Foundation::BOOL diff --git a/crates/libs/windows/src/Windows/Win32/NetworkManagement/IpHelper/mod.rs b/crates/libs/windows/src/Windows/Win32/NetworkManagement/IpHelper/mod.rs index 34625c01a2..30b064893a 100644 --- a/crates/libs/windows/src/Windows/Win32/NetworkManagement/IpHelper/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/NetworkManagement/IpHelper/mod.rs @@ -789,7 +789,7 @@ pub unsafe fn GetUnicastIpAddressTable(family: super::super::Networking::WinSock pub unsafe fn Icmp6CreateFile() -> windows_core::Result { windows_targets::link!("iphlpapi.dll" "system" fn Icmp6CreateFile() -> super::super::Foundation:: HANDLE); let result__ = Icmp6CreateFile(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn Icmp6ParseReplies(replybuffer: *mut core::ffi::c_void, replysize: u32) -> u32 { @@ -818,7 +818,7 @@ where pub unsafe fn IcmpCreateFile() -> windows_core::Result { windows_targets::link!("iphlpapi.dll" "system" fn IcmpCreateFile() -> super::super::Foundation:: HANDLE); let result__ = IcmpCreateFile(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn IcmpParseReplies(replybuffer: *mut core::ffi::c_void, replysize: u32) -> u32 { diff --git a/crates/libs/windows/src/Windows/Win32/Networking/Clustering/mod.rs b/crates/libs/windows/src/Windows/Win32/Networking/Clustering/mod.rs index 27212cb53e..9b06bcdcbc 100644 --- a/crates/libs/windows/src/Windows/Win32/Networking/Clustering/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Networking/Clustering/mod.rs @@ -1732,7 +1732,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterGroupKey(hgroup : HGROUP, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterGroupKey(hgroup.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClusterGroupState(hgroup: P0, lpsznodename: windows_core::PWSTR, lpcchnodename: Option<*mut u32>) -> CLUSTER_GROUP_STATE @@ -1758,7 +1758,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterKey(hcluster : HCLUSTER, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterKey(hcluster.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClusterNetInterface(hcluster: P0, lpsznodename: P1, lpsznetworkname: P2, lpszinterfacename: windows_core::PWSTR, lpcchinterfacename: *mut u32) -> u32 @@ -1778,7 +1778,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterNetInterfaceKey(hnetinterface : HNETINTERFACE, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterNetInterfaceKey(hnetinterface.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClusterNetInterfaceState(hnetinterface: P0) -> CLUSTER_NETINTERFACE_STATE @@ -1804,7 +1804,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterNetworkKey(hnetwork : HNETWORK, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterNetworkKey(hnetwork.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClusterNetworkState(hnetwork: P0) -> CLUSTER_NETWORK_STATE @@ -1830,7 +1830,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterNodeKey(hnode : HNODE, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterNodeKey(hnode.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClusterNodeState(hnode: P0) -> CLUSTER_NODE_STATE @@ -1895,7 +1895,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterResourceKey(hresource : HRESOURCE, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterResourceKey(hresource.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClusterResourceNetworkName(hresource: P0, lpbuffer: windows_core::PWSTR, nsize: *mut u32) -> windows_core::Result<()> @@ -1922,7 +1922,7 @@ where { windows_targets::link!("clusapi.dll" "system" fn GetClusterResourceTypeKey(hcluster : HCLUSTER, lpsztypename : windows_core::PCWSTR, samdesired : u32) -> super::super::System::Registry:: HKEY); let result__ = GetClusterResourceTypeKey(hcluster.param().abi(), lpsztypename.param().abi(), samdesired); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetNodeCloudTypeDW(ppsznodename: P0, nodecloudtype: *mut u32) -> u32 diff --git a/crates/libs/windows/src/Windows/Win32/Networking/WinInet/mod.rs b/crates/libs/windows/src/Windows/Win32/Networking/WinInet/mod.rs index 2019077452..5d4b43541d 100644 --- a/crates/libs/windows/src/Windows/Win32/Networking/WinInet/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Networking/WinInet/mod.rs @@ -314,7 +314,7 @@ where { windows_targets::link!("wininet.dll" "system" fn FindFirstUrlCacheEntryA(lpszurlsearchpattern : windows_core::PCSTR, lpfirstcacheentryinfo : *mut INTERNET_CACHE_ENTRY_INFOA, lpcbcacheentryinfo : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstUrlCacheEntryA(lpszurlsearchpattern.param().abi(), core::mem::transmute(lpfirstcacheentryinfo.unwrap_or(std::ptr::null_mut())), lpcbcacheentryinfo); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstUrlCacheEntryExA(lpszurlsearchpattern: P0, dwflags: u32, dwfilter: u32, groupid: i64, lpfirstcacheentryinfo: Option<*mut INTERNET_CACHE_ENTRY_INFOA>, lpcbcacheentryinfo: *mut u32, lpgroupattributes: Option<*const core::ffi::c_void>, lpcbgroupattributes: Option<*const u32>, lpreserved: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -323,7 +323,7 @@ where { windows_targets::link!("wininet.dll" "system" fn FindFirstUrlCacheEntryExA(lpszurlsearchpattern : windows_core::PCSTR, dwflags : u32, dwfilter : u32, groupid : i64, lpfirstcacheentryinfo : *mut INTERNET_CACHE_ENTRY_INFOA, lpcbcacheentryinfo : *mut u32, lpgroupattributes : *const core::ffi::c_void, lpcbgroupattributes : *const u32, lpreserved : *const core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = FindFirstUrlCacheEntryExA(lpszurlsearchpattern.param().abi(), dwflags, dwfilter, groupid, core::mem::transmute(lpfirstcacheentryinfo.unwrap_or(std::ptr::null_mut())), lpcbcacheentryinfo, core::mem::transmute(lpgroupattributes.unwrap_or(std::ptr::null())), core::mem::transmute(lpcbgroupattributes.unwrap_or(std::ptr::null())), core::mem::transmute(lpreserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstUrlCacheEntryExW(lpszurlsearchpattern: P0, dwflags: u32, dwfilter: u32, groupid: i64, lpfirstcacheentryinfo: Option<*mut INTERNET_CACHE_ENTRY_INFOW>, lpcbcacheentryinfo: *mut u32, lpgroupattributes: Option<*const core::ffi::c_void>, lpcbgroupattributes: Option<*const u32>, lpreserved: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -332,7 +332,7 @@ where { windows_targets::link!("wininet.dll" "system" fn FindFirstUrlCacheEntryExW(lpszurlsearchpattern : windows_core::PCWSTR, dwflags : u32, dwfilter : u32, groupid : i64, lpfirstcacheentryinfo : *mut INTERNET_CACHE_ENTRY_INFOW, lpcbcacheentryinfo : *mut u32, lpgroupattributes : *const core::ffi::c_void, lpcbgroupattributes : *const u32, lpreserved : *const core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = FindFirstUrlCacheEntryExW(lpszurlsearchpattern.param().abi(), dwflags, dwfilter, groupid, core::mem::transmute(lpfirstcacheentryinfo.unwrap_or(std::ptr::null_mut())), lpcbcacheentryinfo, core::mem::transmute(lpgroupattributes.unwrap_or(std::ptr::null())), core::mem::transmute(lpcbgroupattributes.unwrap_or(std::ptr::null())), core::mem::transmute(lpreserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstUrlCacheEntryW(lpszurlsearchpattern: P0, lpfirstcacheentryinfo: Option<*mut INTERNET_CACHE_ENTRY_INFOW>, lpcbcacheentryinfo: *mut u32) -> windows_core::Result @@ -341,13 +341,13 @@ where { windows_targets::link!("wininet.dll" "system" fn FindFirstUrlCacheEntryW(lpszurlsearchpattern : windows_core::PCWSTR, lpfirstcacheentryinfo : *mut INTERNET_CACHE_ENTRY_INFOW, lpcbcacheentryinfo : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstUrlCacheEntryW(lpszurlsearchpattern.param().abi(), core::mem::transmute(lpfirstcacheentryinfo.unwrap_or(std::ptr::null_mut())), lpcbcacheentryinfo); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstUrlCacheGroup(dwflags: u32, dwfilter: u32, lpsearchcondition: Option<*const core::ffi::c_void>, dwsearchcondition: u32, lpgroupid: *mut i64, lpreserved: Option<*const core::ffi::c_void>) -> windows_core::Result { windows_targets::link!("wininet.dll" "system" fn FindFirstUrlCacheGroup(dwflags : u32, dwfilter : u32, lpsearchcondition : *const core::ffi::c_void, dwsearchcondition : u32, lpgroupid : *mut i64, lpreserved : *const core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = FindFirstUrlCacheGroup(dwflags, dwfilter, core::mem::transmute(lpsearchcondition.unwrap_or(std::ptr::null())), dwsearchcondition, lpgroupid, core::mem::transmute(lpreserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindNextUrlCacheContainerA(henumhandle: P0, lpcontainerinfo: *mut INTERNET_CACHE_CONTAINER_INFOA, lpcbcontainerinfo: *mut u32) -> super::super::Foundation::BOOL @@ -1857,7 +1857,7 @@ where { windows_targets::link!("wininet.dll" "system" fn RetrieveUrlCacheEntryStreamA(lpszurlname : windows_core::PCSTR, lpcacheentryinfo : *mut INTERNET_CACHE_ENTRY_INFOA, lpcbcacheentryinfo : *mut u32, frandomread : super::super::Foundation:: BOOL, dwreserved : u32) -> super::super::Foundation:: HANDLE); let result__ = RetrieveUrlCacheEntryStreamA(lpszurlname.param().abi(), core::mem::transmute(lpcacheentryinfo.unwrap_or(std::ptr::null_mut())), lpcbcacheentryinfo, frandomread.param().abi(), dwreserved); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RetrieveUrlCacheEntryStreamW(lpszurlname: P0, lpcacheentryinfo: Option<*mut INTERNET_CACHE_ENTRY_INFOW>, lpcbcacheentryinfo: *mut u32, frandomread: P1, dwreserved: u32) -> windows_core::Result @@ -1867,7 +1867,7 @@ where { windows_targets::link!("wininet.dll" "system" fn RetrieveUrlCacheEntryStreamW(lpszurlname : windows_core::PCWSTR, lpcacheentryinfo : *mut INTERNET_CACHE_ENTRY_INFOW, lpcbcacheentryinfo : *mut u32, frandomread : super::super::Foundation:: BOOL, dwreserved : u32) -> super::super::Foundation:: HANDLE); let result__ = RetrieveUrlCacheEntryStreamW(lpszurlname.param().abi(), core::mem::transmute(lpcacheentryinfo.unwrap_or(std::ptr::null_mut())), lpcbcacheentryinfo, frandomread.param().abi(), dwreserved); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RunOnceUrlCache(hwnd: P0, hinst: P1, lpszcmd: P2, ncmdshow: i32) -> u32 diff --git a/crates/libs/windows/src/Windows/Win32/Networking/WinSock/mod.rs b/crates/libs/windows/src/Windows/Win32/Networking/WinSock/mod.rs index c9c23abcad..ca21a6ef13 100644 --- a/crates/libs/windows/src/Windows/Win32/Networking/WinSock/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Networking/WinSock/mod.rs @@ -379,7 +379,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAccept(s : SOCKET, addr : *mut SOCKADDR, addrlen : *mut i32, lpfncondition : LPCONDITIONPROC, dwcallbackdata : usize) -> SOCKET); let result__ = WSAAccept(s.param().abi(), core::mem::transmute(addr.unwrap_or(std::ptr::null_mut())), core::mem::transmute(addrlen.unwrap_or(std::ptr::null_mut())), lpfncondition, dwcallbackdata); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAddressToStringA(lpsaaddress: *const SOCKADDR, dwaddresslength: u32, lpprotocolinfo: Option<*const WSAPROTOCOL_INFOA>, lpszaddressstring: windows_core::PSTR, lpdwaddressstringlength: *mut u32) -> i32 { @@ -404,7 +404,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAsyncGetHostByAddr(hwnd : super::super::Foundation:: HWND, wmsg : u32, addr : windows_core::PCSTR, len : i32, r#type : i32, buf : windows_core::PSTR, buflen : i32) -> super::super::Foundation:: HANDLE); let result__ = WSAAsyncGetHostByAddr(hwnd.param().abi(), wmsg, core::mem::transmute(addr.as_ptr()), addr.len().try_into().unwrap(), r#type, core::mem::transmute(buf.as_ptr()), buf.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAsyncGetHostByName(hwnd: P0, wmsg: u32, name: P1, buf: &mut [u8]) -> windows_core::Result @@ -414,7 +414,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAsyncGetHostByName(hwnd : super::super::Foundation:: HWND, wmsg : u32, name : windows_core::PCSTR, buf : windows_core::PSTR, buflen : i32) -> super::super::Foundation:: HANDLE); let result__ = WSAAsyncGetHostByName(hwnd.param().abi(), wmsg, name.param().abi(), core::mem::transmute(buf.as_ptr()), buf.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAsyncGetProtoByName(hwnd: P0, wmsg: u32, name: P1, buf: &mut [u8]) -> windows_core::Result @@ -424,7 +424,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAsyncGetProtoByName(hwnd : super::super::Foundation:: HWND, wmsg : u32, name : windows_core::PCSTR, buf : windows_core::PSTR, buflen : i32) -> super::super::Foundation:: HANDLE); let result__ = WSAAsyncGetProtoByName(hwnd.param().abi(), wmsg, name.param().abi(), core::mem::transmute(buf.as_ptr()), buf.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAsyncGetProtoByNumber(hwnd: P0, wmsg: u32, number: i32, buf: &mut [u8]) -> windows_core::Result @@ -433,7 +433,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAsyncGetProtoByNumber(hwnd : super::super::Foundation:: HWND, wmsg : u32, number : i32, buf : windows_core::PSTR, buflen : i32) -> super::super::Foundation:: HANDLE); let result__ = WSAAsyncGetProtoByNumber(hwnd.param().abi(), wmsg, number, core::mem::transmute(buf.as_ptr()), buf.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAsyncGetServByName(hwnd: P0, wmsg: u32, name: P1, proto: P2, buf: &mut [u8]) -> windows_core::Result @@ -444,7 +444,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAsyncGetServByName(hwnd : super::super::Foundation:: HWND, wmsg : u32, name : windows_core::PCSTR, proto : windows_core::PCSTR, buf : windows_core::PSTR, buflen : i32) -> super::super::Foundation:: HANDLE); let result__ = WSAAsyncGetServByName(hwnd.param().abi(), wmsg, name.param().abi(), proto.param().abi(), core::mem::transmute(buf.as_ptr()), buf.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAsyncGetServByPort(hwnd: P0, wmsg: u32, port: i32, proto: P1, buf: &mut [u8]) -> windows_core::Result @@ -454,7 +454,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAAsyncGetServByPort(hwnd : super::super::Foundation:: HWND, wmsg : u32, port : i32, proto : windows_core::PCSTR, buf : windows_core::PSTR, buflen : i32) -> super::super::Foundation:: HANDLE); let result__ = WSAAsyncGetServByPort(hwnd.param().abi(), wmsg, port, proto.param().abi(), core::mem::transmute(buf.as_ptr()), buf.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAAsyncSelect(s: P0, hwnd: P1, wmsg: u32, levent: i32) -> i32 @@ -534,7 +534,7 @@ where pub unsafe fn WSACreateEvent() -> windows_core::Result { windows_targets::link!("ws2_32.dll" "system" fn WSACreateEvent() -> WSAEVENT); let result__ = WSACreateEvent(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_IO")] #[inline] @@ -709,7 +709,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn WSAJoinLeaf(s : SOCKET, name : *const SOCKADDR, namelen : i32, lpcallerdata : *const WSABUF, lpcalleedata : *mut WSABUF, lpsqos : *const QOS, lpgqos : *const QOS, dwflags : u32) -> SOCKET); let result__ = WSAJoinLeaf(s.param().abi(), name, namelen, core::mem::transmute(lpcallerdata.unwrap_or(std::ptr::null())), core::mem::transmute(lpcalleedata.unwrap_or(std::ptr::null_mut())), core::mem::transmute(lpsqos.unwrap_or(std::ptr::null())), core::mem::transmute(lpgqos.unwrap_or(std::ptr::null())), dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Com")] #[inline] @@ -941,13 +941,13 @@ where pub unsafe fn WSASocketA(af: i32, r#type: i32, protocol: i32, lpprotocolinfo: Option<*const WSAPROTOCOL_INFOA>, g: u32, dwflags: u32) -> windows_core::Result { windows_targets::link!("ws2_32.dll" "system" fn WSASocketA(af : i32, r#type : i32, protocol : i32, lpprotocolinfo : *const WSAPROTOCOL_INFOA, g : u32, dwflags : u32) -> SOCKET); let result__ = WSASocketA(af, r#type, protocol, core::mem::transmute(lpprotocolinfo.unwrap_or(std::ptr::null())), g, dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSASocketW(af: i32, r#type: i32, protocol: i32, lpprotocolinfo: Option<*const WSAPROTOCOL_INFOW>, g: u32, dwflags: u32) -> windows_core::Result { windows_targets::link!("ws2_32.dll" "system" fn WSASocketW(af : i32, r#type : i32, protocol : i32, lpprotocolinfo : *const WSAPROTOCOL_INFOW, g : u32, dwflags : u32) -> SOCKET); let result__ = WSASocketW(af, r#type, protocol, core::mem::transmute(lpprotocolinfo.unwrap_or(std::ptr::null())), g, dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32 { @@ -1217,7 +1217,7 @@ where { windows_targets::link!("ws2_32.dll" "system" fn accept(s : SOCKET, addr : *mut SOCKADDR, addrlen : *mut i32) -> SOCKET); let result__ = accept(s.param().abi(), core::mem::transmute(addr.unwrap_or(std::ptr::null_mut())), core::mem::transmute(addrlen.unwrap_or(std::ptr::null_mut()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn bind(s: P0, name: *const SOCKADDR, namelen: i32) -> i32 @@ -1456,7 +1456,7 @@ where pub unsafe fn socket(af: i32, r#type: WINSOCK_SOCKET_TYPE, protocol: i32) -> windows_core::Result { windows_targets::link!("ws2_32.dll" "system" fn socket(af : i32, r#type : WINSOCK_SOCKET_TYPE, protocol : i32) -> SOCKET); let result__ = socket(af, r#type, protocol); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } pub const AAL5_MODE_MESSAGE: u32 = 1u32; pub const AAL5_MODE_STREAMING: u32 = 2u32; diff --git a/crates/libs/windows/src/Windows/Win32/Security/Authorization/UI/mod.rs b/crates/libs/windows/src/Windows/Win32/Security/Authorization/UI/mod.rs index 5ee2d63856..7e259edbdc 100644 --- a/crates/libs/windows/src/Windows/Win32/Security/Authorization/UI/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Security/Authorization/UI/mod.rs @@ -6,7 +6,7 @@ where { windows_targets::link!("aclui.dll" "system" fn CreateSecurityPage(psi : * mut core::ffi::c_void) -> super::super::super::UI::Controls:: HPROPSHEETPAGE); let result__ = CreateSecurityPage(psi.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EditSecurity(hwndowner: P0, psi: P1) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/Security/Credentials/mod.rs b/crates/libs/windows/src/Windows/Win32/Security/Credentials/mod.rs index b3302465f1..1d99c45e8b 100644 --- a/crates/libs/windows/src/Windows/Win32/Security/Credentials/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Security/Credentials/mod.rs @@ -391,7 +391,7 @@ where pub unsafe fn SCardAccessStartedEvent() -> windows_core::Result { windows_targets::link!("winscard.dll" "system" fn SCardAccessStartedEvent() -> super::super::Foundation:: HANDLE); let result__ = SCardAccessStartedEvent(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SCardAddReaderToGroupA(hcontext: usize, szreadername: P0, szgroupname: P1) -> i32 diff --git a/crates/libs/windows/src/Windows/Win32/Security/Cryptography/mod.rs b/crates/libs/windows/src/Windows/Win32/Security/Cryptography/mod.rs index 59728dc7b8..660e115aaa 100644 --- a/crates/libs/windows/src/Windows/Win32/Security/Cryptography/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Security/Cryptography/mod.rs @@ -978,7 +978,7 @@ where { windows_targets::link!("crypt32.dll" "system" fn CertOpenStore(lpszstoreprovider : windows_core::PCSTR, dwencodingtype : CERT_QUERY_ENCODING_TYPE, hcryptprov : HCRYPTPROV_LEGACY, dwflags : CERT_OPEN_STORE_FLAGS, pvpara : *const core::ffi::c_void) -> HCERTSTORE); let result__ = CertOpenStore(lpszstoreprovider.param().abi(), dwencodingtype, hcryptprov.param().abi(), dwflags, core::mem::transmute(pvpara.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CertOpenSystemStoreA(hprov: P0, szsubsystemprotocol: P1) -> windows_core::Result @@ -988,7 +988,7 @@ where { windows_targets::link!("crypt32.dll" "system" fn CertOpenSystemStoreA(hprov : HCRYPTPROV_LEGACY, szsubsystemprotocol : windows_core::PCSTR) -> HCERTSTORE); let result__ = CertOpenSystemStoreA(hprov.param().abi(), szsubsystemprotocol.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CertOpenSystemStoreW(hprov: P0, szsubsystemprotocol: P1) -> windows_core::Result @@ -998,7 +998,7 @@ where { windows_targets::link!("crypt32.dll" "system" fn CertOpenSystemStoreW(hprov : HCRYPTPROV_LEGACY, szsubsystemprotocol : windows_core::PCWSTR) -> HCERTSTORE); let result__ = CertOpenSystemStoreW(hprov.param().abi(), szsubsystemprotocol.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CertRDNValueToStrA(dwvaluetype: u32, pvalue: *const CRYPT_INTEGER_BLOB, psz: Option<&mut [u8]>) -> u32 { @@ -1548,7 +1548,7 @@ where { windows_targets::link!("crypt32.dll" "system" fn CryptGetMessageCertificates(dwmsgandcertencodingtype : u32, hcryptprov : HCRYPTPROV_LEGACY, dwflags : u32, pbsignedblob : *const u8, cbsignedblob : u32) -> HCERTSTORE); let result__ = CryptGetMessageCertificates(dwmsgandcertencodingtype, hcryptprov.param().abi(), dwflags, core::mem::transmute(pbsignedblob.as_ptr()), pbsignedblob.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CryptGetMessageSignerCount(dwmsgencodingtype: u32, pbsignedblob: &[u8]) -> i32 { @@ -2710,7 +2710,7 @@ where { windows_targets::link!("crypt32.dll" "system" fn PFXImportCertStore(ppfx : *const CRYPT_INTEGER_BLOB, szpassword : windows_core::PCWSTR, dwflags : CRYPT_KEY_FLAGS) -> HCERTSTORE); let result__ = PFXImportCertStore(ppfx, szpassword.param().abi(), dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn PFXIsPFXBlob(ppfx: *const CRYPT_INTEGER_BLOB) -> super::super::Foundation::BOOL { diff --git a/crates/libs/windows/src/Windows/Win32/Storage/FileSystem/mod.rs b/crates/libs/windows/src/Windows/Win32/Storage/FileSystem/mod.rs index f50c4d2eb7..9b12954b3b 100644 --- a/crates/libs/windows/src/Windows/Win32/Storage/FileSystem/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/Storage/FileSystem/mod.rs @@ -363,7 +363,7 @@ where { windows_targets::link!("ktmw32.dll" "system" fn CreateEnlistment(lpenlistmentattributes : *mut super::super::Security:: SECURITY_ATTRIBUTES, resourcemanagerhandle : super::super::Foundation:: HANDLE, transactionhandle : super::super::Foundation:: HANDLE, notificationmask : u32, createoptions : u32, enlistmentkey : *mut core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = CreateEnlistment(lpenlistmentattributes, resourcemanagerhandle.param().abi(), transactionhandle.param().abi(), notificationmask, createoptions, enlistmentkey); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -373,7 +373,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFile2(lpfilename : windows_core::PCWSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, dwcreationdisposition : FILE_CREATION_DISPOSITION, pcreateexparams : *const CREATEFILE2_EXTENDED_PARAMETERS) -> super::super::Foundation:: HANDLE); let result__ = CreateFile2(lpfilename.param().abi(), dwdesiredaccess, dwsharemode, dwcreationdisposition, core::mem::transmute(pcreateexparams.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -393,7 +393,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileA(lpfilename : windows_core::PCSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = CreateFileA(lpfilename.param().abi(), dwdesiredaccess, dwsharemode, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null())), dwcreationdisposition, dwflagsandattributes, htemplatefile.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -415,7 +415,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileTransactedA(lpfilename : windows_core::PCSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : super::super::Foundation:: HANDLE, htransaction : super::super::Foundation:: HANDLE, pusminiversion : *const TXFS_MINIVERSION, lpextendedparameter : *const core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = CreateFileTransactedA(lpfilename.param().abi(), dwdesiredaccess, dwsharemode, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null())), dwcreationdisposition, dwflagsandattributes, htemplatefile.param().abi(), htransaction.param().abi(), core::mem::transmute(pusminiversion.unwrap_or(std::ptr::null())), core::mem::transmute(lpextendedparameter.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -427,7 +427,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileTransactedW(lpfilename : windows_core::PCWSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : super::super::Foundation:: HANDLE, htransaction : super::super::Foundation:: HANDLE, pusminiversion : *const TXFS_MINIVERSION, lpextendedparameter : *const core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = CreateFileTransactedW(lpfilename.param().abi(), dwdesiredaccess, dwsharemode, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null())), dwcreationdisposition, dwflagsandattributes, htemplatefile.param().abi(), htransaction.param().abi(), core::mem::transmute(pusminiversion.unwrap_or(std::ptr::null())), core::mem::transmute(lpextendedparameter.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -438,7 +438,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileW(lpfilename : windows_core::PCWSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = CreateFileW(lpfilename.param().abi(), dwdesiredaccess, dwsharemode, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null())), dwcreationdisposition, dwflagsandattributes, htemplatefile.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -505,7 +505,7 @@ where { windows_targets::link!("clfsw32.dll" "system" fn CreateLogFile(pszlogfilename : windows_core::PCWSTR, fdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, psalogfile : *mut super::super::Security:: SECURITY_ATTRIBUTES, fcreatedisposition : FILE_CREATION_DISPOSITION, fflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES) -> super::super::Foundation:: HANDLE); let result__ = CreateLogFile(pszlogfilename.param().abi(), fdesiredaccess, dwsharemode, psalogfile, fcreatedisposition, fflagsandattributes); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateLogMarshallingArea(hlog: P0, pfnallocbuffer: CLFS_BLOCK_ALLOCATION, pfnfreebuffer: CLFS_BLOCK_DEALLOCATION, pvblockalloccontext: *mut core::ffi::c_void, cbmarshallingbuffer: u32, cmaxwritebuffers: u32, cmaxreadbuffers: u32, ppvmarshal: *mut *mut core::ffi::c_void) -> windows_core::Result<()> @@ -524,7 +524,7 @@ where { windows_targets::link!("ktmw32.dll" "system" fn CreateResourceManager(lpresourcemanagerattributes : *mut super::super::Security:: SECURITY_ATTRIBUTES, resourcemanagerid : *mut windows_core::GUID, createoptions : u32, tmhandle : super::super::Foundation:: HANDLE, description : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateResourceManager(lpresourcemanagerattributes, resourcemanagerid, createoptions, tmhandle.param().abi(), description.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateSymbolicLinkA(lpsymlinkfilename: P0, lptargetfilename: P1, dwflags: SYMBOLIC_LINK_FLAGS) -> super::super::Foundation::BOOLEAN @@ -580,7 +580,7 @@ where { windows_targets::link!("ktmw32.dll" "system" fn CreateTransaction(lptransactionattributes : *mut super::super::Security:: SECURITY_ATTRIBUTES, uow : *mut windows_core::GUID, createoptions : u32, isolationlevel : u32, isolationflags : u32, timeout : u32, description : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateTransaction(lptransactionattributes, uow, createoptions, isolationlevel, isolationflags, timeout, description.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -590,7 +590,7 @@ where { windows_targets::link!("ktmw32.dll" "system" fn CreateTransactionManager(lptransactionattributes : *mut super::super::Security:: SECURITY_ATTRIBUTES, logfilename : windows_core::PCWSTR, createoptions : u32, commitstrength : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateTransactionManager(lptransactionattributes, logfilename.param().abi(), createoptions, commitstrength); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DecryptFileA(lpfilename: P0, dwreserved: u32) -> windows_core::Result<()> @@ -799,7 +799,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstChangeNotificationA(lppathname : windows_core::PCSTR, bwatchsubtree : super::super::Foundation:: BOOL, dwnotifyfilter : FILE_NOTIFY_CHANGE) -> super::super::Foundation:: HANDLE); let result__ = FindFirstChangeNotificationA(lppathname.param().abi(), bwatchsubtree.param().abi(), dwnotifyfilter); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstChangeNotificationW(lppathname: P0, bwatchsubtree: P1, dwnotifyfilter: FILE_NOTIFY_CHANGE) -> windows_core::Result @@ -809,7 +809,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstChangeNotificationW(lppathname : windows_core::PCWSTR, bwatchsubtree : super::super::Foundation:: BOOL, dwnotifyfilter : FILE_NOTIFY_CHANGE) -> super::super::Foundation:: HANDLE); let result__ = FindFirstChangeNotificationW(lppathname.param().abi(), bwatchsubtree.param().abi(), dwnotifyfilter); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileA(lpfilename: P0, lpfindfiledata: *mut WIN32_FIND_DATAA) -> windows_core::Result @@ -818,7 +818,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileA(lpfilename : windows_core::PCSTR, lpfindfiledata : *mut WIN32_FIND_DATAA) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileA(lpfilename.param().abi(), lpfindfiledata); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileExA(lpfilename: P0, finfolevelid: FINDEX_INFO_LEVELS, lpfindfiledata: *mut core::ffi::c_void, fsearchop: FINDEX_SEARCH_OPS, lpsearchfilter: Option<*const core::ffi::c_void>, dwadditionalflags: FIND_FIRST_EX_FLAGS) -> windows_core::Result @@ -827,7 +827,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileExA(lpfilename : windows_core::PCSTR, finfolevelid : FINDEX_INFO_LEVELS, lpfindfiledata : *mut core::ffi::c_void, fsearchop : FINDEX_SEARCH_OPS, lpsearchfilter : *const core::ffi::c_void, dwadditionalflags : FIND_FIRST_EX_FLAGS) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileExA(lpfilename.param().abi(), finfolevelid, lpfindfiledata, fsearchop, core::mem::transmute(lpsearchfilter.unwrap_or(std::ptr::null())), dwadditionalflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileExFromAppW(lpfilename: P0, finfolevelid: FINDEX_INFO_LEVELS, lpfindfiledata: *mut core::ffi::c_void, fsearchop: FINDEX_SEARCH_OPS, lpsearchfilter: Option<*const core::ffi::c_void>, dwadditionalflags: u32) -> super::super::Foundation::HANDLE @@ -844,7 +844,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileExW(lpfilename : windows_core::PCWSTR, finfolevelid : FINDEX_INFO_LEVELS, lpfindfiledata : *mut core::ffi::c_void, fsearchop : FINDEX_SEARCH_OPS, lpsearchfilter : *const core::ffi::c_void, dwadditionalflags : FIND_FIRST_EX_FLAGS) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileExW(lpfilename.param().abi(), finfolevelid, lpfindfiledata, fsearchop, core::mem::transmute(lpsearchfilter.unwrap_or(std::ptr::null())), dwadditionalflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileNameTransactedW(lpfilename: P0, dwflags: u32, stringlength: *mut u32, linkname: windows_core::PWSTR, htransaction: P1) -> windows_core::Result @@ -854,7 +854,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileNameTransactedW(lpfilename : windows_core::PCWSTR, dwflags : u32, stringlength : *mut u32, linkname : windows_core::PWSTR, htransaction : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileNameTransactedW(lpfilename.param().abi(), dwflags, stringlength, core::mem::transmute(linkname), htransaction.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileNameW(lpfilename: P0, dwflags: u32, stringlength: *mut u32, linkname: windows_core::PWSTR) -> windows_core::Result @@ -863,7 +863,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileNameW(lpfilename : windows_core::PCWSTR, dwflags : u32, stringlength : *mut u32, linkname : windows_core::PWSTR) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileNameW(lpfilename.param().abi(), dwflags, stringlength, core::mem::transmute(linkname)); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileTransactedA(lpfilename: P0, finfolevelid: FINDEX_INFO_LEVELS, lpfindfiledata: *mut core::ffi::c_void, fsearchop: FINDEX_SEARCH_OPS, lpsearchfilter: Option<*const core::ffi::c_void>, dwadditionalflags: u32, htransaction: P1) -> windows_core::Result @@ -873,7 +873,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileTransactedA(lpfilename : windows_core::PCSTR, finfolevelid : FINDEX_INFO_LEVELS, lpfindfiledata : *mut core::ffi::c_void, fsearchop : FINDEX_SEARCH_OPS, lpsearchfilter : *const core::ffi::c_void, dwadditionalflags : u32, htransaction : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileTransactedA(lpfilename.param().abi(), finfolevelid, lpfindfiledata, fsearchop, core::mem::transmute(lpsearchfilter.unwrap_or(std::ptr::null())), dwadditionalflags, htransaction.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileTransactedW(lpfilename: P0, finfolevelid: FINDEX_INFO_LEVELS, lpfindfiledata: *mut core::ffi::c_void, fsearchop: FINDEX_SEARCH_OPS, lpsearchfilter: Option<*const core::ffi::c_void>, dwadditionalflags: u32, htransaction: P1) -> windows_core::Result @@ -883,7 +883,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileTransactedW(lpfilename : windows_core::PCWSTR, finfolevelid : FINDEX_INFO_LEVELS, lpfindfiledata : *mut core::ffi::c_void, fsearchop : FINDEX_SEARCH_OPS, lpsearchfilter : *const core::ffi::c_void, dwadditionalflags : u32, htransaction : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileTransactedW(lpfilename.param().abi(), finfolevelid, lpfindfiledata, fsearchop, core::mem::transmute(lpsearchfilter.unwrap_or(std::ptr::null())), dwadditionalflags, htransaction.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstFileW(lpfilename: P0, lpfindfiledata: *mut WIN32_FIND_DATAW) -> windows_core::Result @@ -892,7 +892,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstFileW(lpfilename : windows_core::PCWSTR, lpfindfiledata : *mut WIN32_FIND_DATAW) -> super::super::Foundation:: HANDLE); let result__ = FindFirstFileW(lpfilename.param().abi(), lpfindfiledata); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstStreamTransactedW(lpfilename: P0, infolevel: STREAM_INFO_LEVELS, lpfindstreamdata: *mut core::ffi::c_void, dwflags: u32, htransaction: P1) -> windows_core::Result @@ -902,7 +902,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstStreamTransactedW(lpfilename : windows_core::PCWSTR, infolevel : STREAM_INFO_LEVELS, lpfindstreamdata : *mut core::ffi::c_void, dwflags : u32, htransaction : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = FindFirstStreamTransactedW(lpfilename.param().abi(), infolevel, lpfindstreamdata, dwflags, htransaction.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstStreamW(lpfilename: P0, infolevel: STREAM_INFO_LEVELS, lpfindstreamdata: *mut core::ffi::c_void, dwflags: u32) -> windows_core::Result @@ -911,13 +911,13 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstStreamW(lpfilename : windows_core::PCWSTR, infolevel : STREAM_INFO_LEVELS, lpfindstreamdata : *mut core::ffi::c_void, dwflags : u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstStreamW(lpfilename.param().abi(), infolevel, lpfindstreamdata, dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstVolumeA(lpszvolumename: &mut [u8]) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn FindFirstVolumeA(lpszvolumename : windows_core::PSTR, cchbufferlength : u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstVolumeA(core::mem::transmute(lpszvolumename.as_ptr()), lpszvolumename.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstVolumeMountPointA(lpszrootpathname: P0, lpszvolumemountpoint: &mut [u8]) -> windows_core::Result @@ -926,7 +926,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstVolumeMountPointA(lpszrootpathname : windows_core::PCSTR, lpszvolumemountpoint : windows_core::PSTR, cchbufferlength : u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstVolumeMountPointA(lpszrootpathname.param().abi(), core::mem::transmute(lpszvolumemountpoint.as_ptr()), lpszvolumemountpoint.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstVolumeMountPointW(lpszrootpathname: P0, lpszvolumemountpoint: &mut [u16]) -> windows_core::Result @@ -935,13 +935,13 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindFirstVolumeMountPointW(lpszrootpathname : windows_core::PCWSTR, lpszvolumemountpoint : windows_core::PWSTR, cchbufferlength : u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstVolumeMountPointW(lpszrootpathname.param().abi(), core::mem::transmute(lpszvolumemountpoint.as_ptr()), lpszvolumemountpoint.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFirstVolumeW(lpszvolumename: &mut [u16]) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn FindFirstVolumeW(lpszvolumename : windows_core::PWSTR, cchbufferlength : u32) -> super::super::Foundation:: HANDLE); let result__ = FindFirstVolumeW(core::mem::transmute(lpszvolumename.as_ptr()), lpszvolumename.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindNextChangeNotification(hchangehandle: P0) -> windows_core::Result<()> @@ -2196,7 +2196,7 @@ where { windows_targets::link!("ktmw32.dll" "system" fn OpenEnlistment(dwdesiredaccess : u32, resourcemanagerhandle : super::super::Foundation:: HANDLE, enlistmentid : *mut windows_core::GUID) -> super::super::Foundation:: HANDLE); let result__ = OpenEnlistment(dwdesiredaccess, resourcemanagerhandle.param().abi(), enlistmentid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenFile(lpfilename: P0, lpreopenbuff: *mut OFSTRUCT, ustyle: u32) -> i32 @@ -2214,7 +2214,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenFileById(hvolumehint : super::super::Foundation:: HANDLE, lpfileid : *const FILE_ID_DESCRIPTOR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES) -> super::super::Foundation:: HANDLE); let result__ = OpenFileById(hvolumehint.param().abi(), lpfileid, dwdesiredaccess, dwsharemode, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null())), dwflagsandattributes); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenResourceManager(dwdesiredaccess: u32, tmhandle: P0, resourcemanagerid: *mut windows_core::GUID) -> windows_core::Result @@ -2223,13 +2223,13 @@ where { windows_targets::link!("ktmw32.dll" "system" fn OpenResourceManager(dwdesiredaccess : u32, tmhandle : super::super::Foundation:: HANDLE, resourcemanagerid : *mut windows_core::GUID) -> super::super::Foundation:: HANDLE); let result__ = OpenResourceManager(dwdesiredaccess, tmhandle.param().abi(), resourcemanagerid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenTransaction(dwdesiredaccess: u32, transactionid: *mut windows_core::GUID) -> windows_core::Result { windows_targets::link!("ktmw32.dll" "system" fn OpenTransaction(dwdesiredaccess : u32, transactionid : *mut windows_core::GUID) -> super::super::Foundation:: HANDLE); let result__ = OpenTransaction(dwdesiredaccess, transactionid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenTransactionManager(logfilename: P0, desiredaccess: u32, openoptions: u32) -> windows_core::Result @@ -2238,13 +2238,13 @@ where { windows_targets::link!("ktmw32.dll" "system" fn OpenTransactionManager(logfilename : windows_core::PCWSTR, desiredaccess : u32, openoptions : u32) -> super::super::Foundation:: HANDLE); let result__ = OpenTransactionManager(logfilename.param().abi(), desiredaccess, openoptions); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenTransactionManagerById(transactionmanagerid: *const windows_core::GUID, desiredaccess: u32, openoptions: u32) -> windows_core::Result { windows_targets::link!("ktmw32.dll" "system" fn OpenTransactionManagerById(transactionmanagerid : *const windows_core::GUID, desiredaccess : u32, openoptions : u32) -> super::super::Foundation:: HANDLE); let result__ = OpenTransactionManagerById(transactionmanagerid, desiredaccess, openoptions); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn PopIoRingCompletion(ioring: P0, cqe: *mut IORING_CQE) -> windows_core::HRESULT @@ -2358,7 +2358,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn ReOpenFile(horiginalfile : super::super::Foundation:: HANDLE, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES) -> super::super::Foundation:: HANDLE); let result__ = ReOpenFile(horiginalfile.param().abi(), dwdesiredaccess, dwsharemode, dwflagsandattributes); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_IO")] #[inline] diff --git a/crates/libs/windows/src/Windows/Win32/System/ApplicationInstallationAndServicing/mod.rs b/crates/libs/windows/src/Windows/Win32/System/ApplicationInstallationAndServicing/mod.rs index d8a236aa45..c273175559 100644 --- a/crates/libs/windows/src/Windows/Win32/System/ApplicationInstallationAndServicing/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/ApplicationInstallationAndServicing/mod.rs @@ -124,13 +124,13 @@ where pub unsafe fn CreateActCtxA(pactctx: *const ACTCTXA) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateActCtxA(pactctx : *const ACTCTXA) -> super::super::Foundation:: HANDLE); let result__ = CreateActCtxA(pactctx); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateActCtxW(pactctx: *const ACTCTXW) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateActCtxW(pactctx : *const ACTCTXW) -> super::super::Foundation:: HANDLE); let result__ = CreateActCtxW(pactctx); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security_Cryptography")] #[inline] diff --git a/crates/libs/windows/src/Windows/Win32/System/Console/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Console/mod.rs index 0c8d5848d6..95a7b2e5a3 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Console/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Console/mod.rs @@ -46,7 +46,7 @@ pub unsafe fn ConsoleControl(command: CONSOLECONTROL, consoleinformation: *const pub unsafe fn CreateConsoleScreenBuffer(dwdesiredaccess: u32, dwsharemode: u32, lpsecurityattributes: Option<*const super::super::Security::SECURITY_ATTRIBUTES>, dwflags: u32, lpscreenbufferdata: Option<*const core::ffi::c_void>) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateConsoleScreenBuffer(dwdesiredaccess : u32, dwsharemode : u32, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwflags : u32, lpscreenbufferdata : *const core::ffi::c_void) -> super::super::Foundation:: HANDLE); let result__ = CreateConsoleScreenBuffer(dwdesiredaccess, dwsharemode, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null())), dwflags, core::mem::transmute(lpscreenbufferdata.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreatePseudoConsole(size: COORD, hinput: P0, houtput: P1, dwflags: u32) -> windows_core::Result @@ -356,7 +356,7 @@ pub unsafe fn GetNumberOfConsoleMouseButtons(lpnumberofmousebuttons: *mut u32) - pub unsafe fn GetStdHandle(nstdhandle: STD_HANDLE) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn GetStdHandle(nstdhandle : STD_HANDLE) -> super::super::Foundation:: HANDLE); let result__ = GetStdHandle(nstdhandle); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn PeekConsoleInputA(hconsoleinput: P0, lpbuffer: &mut [INPUT_RECORD], lpnumberofeventsread: *mut u32) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/DataExchange/mod.rs b/crates/libs/windows/src/Windows/Win32/System/DataExchange/mod.rs index da2c9d3fc5..7cc746750f 100644 --- a/crates/libs/windows/src/Windows/Win32/System/DataExchange/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/DataExchange/mod.rs @@ -350,7 +350,7 @@ pub unsafe fn GetAtomNameW(natom: u16, lpbuffer: &mut [u16]) -> u32 { pub unsafe fn GetClipboardData(uformat: u32) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn GetClipboardData(uformat : u32) -> super::super::Foundation:: HANDLE); let result__ = GetClipboardData(uformat); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClipboardFormatNameA(format: u32, lpszformatname: &mut [u8]) -> i32 { @@ -366,7 +366,7 @@ pub unsafe fn GetClipboardFormatNameW(format: u32, lpszformatname: &mut [u16]) - pub unsafe fn GetClipboardOwner() -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn GetClipboardOwner() -> super::super::Foundation:: HWND); let result__ = GetClipboardOwner(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetClipboardSequenceNumber() -> u32 { @@ -377,13 +377,13 @@ pub unsafe fn GetClipboardSequenceNumber() -> u32 { pub unsafe fn GetClipboardViewer() -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn GetClipboardViewer() -> super::super::Foundation:: HWND); let result__ = GetClipboardViewer(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetOpenClipboardWindow() -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn GetOpenClipboardWindow() -> super::super::Foundation:: HWND); let result__ = GetOpenClipboardWindow(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetPriorityClipboardFormat(paformatprioritylist: &[u32]) -> i32 { @@ -529,7 +529,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetClipboardData(uformat : u32, hmem : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE); let result__ = SetClipboardData(uformat, hmem.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetClipboardViewer(hwndnewviewer: P0) -> windows_core::Result @@ -538,7 +538,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetClipboardViewer(hwndnewviewer : super::super::Foundation:: HWND) -> super::super::Foundation:: HWND); let result__ = SetClipboardViewer(hwndnewviewer.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Graphics_Gdi")] #[inline] diff --git a/crates/libs/windows/src/Windows/Win32/System/Diagnostics/Debug/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Diagnostics/Debug/mod.rs index 44755ba354..b6a2973081 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Diagnostics/Debug/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Diagnostics/Debug/mod.rs @@ -253,7 +253,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn FindDebugInfoFile(filename : windows_core::PCSTR, symbolpath : windows_core::PCSTR, debugfilepath : windows_core::PSTR) -> super::super::super::Foundation:: HANDLE); let result__ = FindDebugInfoFile(filename.param().abi(), symbolpath.param().abi(), core::mem::transmute(debugfilepath)); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindDebugInfoFileEx(filename: P0, symbolpath: P1, debugfilepath: windows_core::PSTR, callback: PFIND_DEBUG_FILE_CALLBACK, callerdata: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -263,7 +263,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn FindDebugInfoFileEx(filename : windows_core::PCSTR, symbolpath : windows_core::PCSTR, debugfilepath : windows_core::PSTR, callback : PFIND_DEBUG_FILE_CALLBACK, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = FindDebugInfoFileEx(filename.param().abi(), symbolpath.param().abi(), core::mem::transmute(debugfilepath), callback, core::mem::transmute(callerdata.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindDebugInfoFileExW(filename: P0, symbolpath: P1, debugfilepath: windows_core::PWSTR, callback: PFIND_DEBUG_FILE_CALLBACKW, callerdata: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -273,7 +273,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn FindDebugInfoFileExW(filename : windows_core::PCWSTR, symbolpath : windows_core::PCWSTR, debugfilepath : windows_core::PWSTR, callback : PFIND_DEBUG_FILE_CALLBACKW, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = FindDebugInfoFileExW(filename.param().abi(), symbolpath.param().abi(), core::mem::transmute(debugfilepath), callback, core::mem::transmute(callerdata.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindExecutableImage(filename: P0, symbolpath: P1, imagefilepath: windows_core::PSTR) -> windows_core::Result @@ -283,7 +283,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn FindExecutableImage(filename : windows_core::PCSTR, symbolpath : windows_core::PCSTR, imagefilepath : windows_core::PSTR) -> super::super::super::Foundation:: HANDLE); let result__ = FindExecutableImage(filename.param().abi(), symbolpath.param().abi(), core::mem::transmute(imagefilepath)); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindExecutableImageEx(filename: P0, symbolpath: P1, imagefilepath: windows_core::PSTR, callback: PFIND_EXE_FILE_CALLBACK, callerdata: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -293,7 +293,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn FindExecutableImageEx(filename : windows_core::PCSTR, symbolpath : windows_core::PCSTR, imagefilepath : windows_core::PSTR, callback : PFIND_EXE_FILE_CALLBACK, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = FindExecutableImageEx(filename.param().abi(), symbolpath.param().abi(), core::mem::transmute(imagefilepath), callback, core::mem::transmute(callerdata.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindExecutableImageExW(filename: P0, symbolpath: P1, imagefilepath: windows_core::PWSTR, callback: PFIND_EXE_FILE_CALLBACKW, callerdata: *const core::ffi::c_void) -> windows_core::Result @@ -303,7 +303,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn FindExecutableImageExW(filename : windows_core::PCWSTR, symbolpath : windows_core::PCWSTR, imagefilepath : windows_core::PWSTR, callback : PFIND_EXE_FILE_CALLBACKW, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = FindExecutableImageExW(filename.param().abi(), symbolpath.param().abi(), core::mem::transmute(imagefilepath), callback, callerdata); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindFileInPath(hprocess: P0, searchpatha: P1, filename: P2, id: *const core::ffi::c_void, two: u32, three: u32, flags: u32, filepath: windows_core::PSTR) -> super::super::super::Foundation::BOOL @@ -1334,7 +1334,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn SymFindDebugInfoFile(hprocess : super::super::super::Foundation:: HANDLE, filename : windows_core::PCSTR, debugfilepath : windows_core::PSTR, callback : PFIND_DEBUG_FILE_CALLBACK, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = SymFindDebugInfoFile(hprocess.param().abi(), filename.param().abi(), core::mem::transmute(debugfilepath), callback, core::mem::transmute(callerdata.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SymFindDebugInfoFileW(hprocess: P0, filename: P1, debugfilepath: windows_core::PWSTR, callback: PFIND_DEBUG_FILE_CALLBACKW, callerdata: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -1344,7 +1344,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn SymFindDebugInfoFileW(hprocess : super::super::super::Foundation:: HANDLE, filename : windows_core::PCWSTR, debugfilepath : windows_core::PWSTR, callback : PFIND_DEBUG_FILE_CALLBACKW, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = SymFindDebugInfoFileW(hprocess.param().abi(), filename.param().abi(), core::mem::transmute(debugfilepath), callback, core::mem::transmute(callerdata.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SymFindExecutableImage(hprocess: P0, filename: P1, imagefilepath: windows_core::PSTR, callback: PFIND_EXE_FILE_CALLBACK, callerdata: *const core::ffi::c_void) -> windows_core::Result @@ -1354,7 +1354,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn SymFindExecutableImage(hprocess : super::super::super::Foundation:: HANDLE, filename : windows_core::PCSTR, imagefilepath : windows_core::PSTR, callback : PFIND_EXE_FILE_CALLBACK, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = SymFindExecutableImage(hprocess.param().abi(), filename.param().abi(), core::mem::transmute(imagefilepath), callback, callerdata); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SymFindExecutableImageW(hprocess: P0, filename: P1, imagefilepath: windows_core::PWSTR, callback: PFIND_EXE_FILE_CALLBACKW, callerdata: *const core::ffi::c_void) -> windows_core::Result @@ -1364,7 +1364,7 @@ where { windows_targets::link!("dbghelp.dll" "system" fn SymFindExecutableImageW(hprocess : super::super::super::Foundation:: HANDLE, filename : windows_core::PCWSTR, imagefilepath : windows_core::PWSTR, callback : PFIND_EXE_FILE_CALLBACKW, callerdata : *const core::ffi::c_void) -> super::super::super::Foundation:: HANDLE); let result__ = SymFindExecutableImageW(hprocess.param().abi(), filename.param().abi(), core::mem::transmute(imagefilepath), callback, callerdata); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SymFindFileInPath(hprocess: P0, searchpatha: P1, filename: P2, id: Option<*const core::ffi::c_void>, two: u32, three: u32, flags: SYM_FIND_ID_OPTION, foundfile: windows_core::PSTR, callback: PFINDFILEINPATHCALLBACK, context: Option<*const core::ffi::c_void>) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/Diagnostics/ToolHelp/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Diagnostics/ToolHelp/mod.rs index 7e7463594f..83cbf4fcb2 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Diagnostics/ToolHelp/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Diagnostics/ToolHelp/mod.rs @@ -2,7 +2,7 @@ pub unsafe fn CreateToolhelp32Snapshot(dwflags: CREATE_TOOLHELP_SNAPSHOT_FLAGS, th32processid: u32) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateToolhelp32Snapshot(dwflags : CREATE_TOOLHELP_SNAPSHOT_FLAGS, th32processid : u32) -> super::super::super::Foundation:: HANDLE); let result__ = CreateToolhelp32Snapshot(dwflags, th32processid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn Heap32First(lphe: *mut HEAPENTRY32, th32processid: u32, th32heapid: usize) -> windows_core::Result<()> { diff --git a/crates/libs/windows/src/Windows/Win32/System/EventLog/mod.rs b/crates/libs/windows/src/Windows/Win32/System/EventLog/mod.rs index 0c7f298927..95720a3f60 100644 --- a/crates/libs/windows/src/Windows/Win32/System/EventLog/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/EventLog/mod.rs @@ -92,13 +92,13 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtCreateBookmark(bookmarkxml : windows_core::PCWSTR) -> EVT_HANDLE); let result__ = EvtCreateBookmark(bookmarkxml.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtCreateRenderContext(valuepaths: Option<&[windows_core::PCWSTR]>, flags: u32) -> windows_core::Result { windows_targets::link!("wevtapi.dll" "system" fn EvtCreateRenderContext(valuepathscount : u32, valuepaths : *const windows_core::PCWSTR, flags : u32) -> EVT_HANDLE); let result__ = EvtCreateRenderContext(valuepaths.as_deref().map_or(0, |slice| slice.len().try_into().unwrap()), core::mem::transmute(valuepaths.as_deref().map_or(core::ptr::null(), |slice| slice.as_ptr())), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtExportLog(session: P0, path: P1, query: P2, targetfilepath: P3, flags: u32) -> windows_core::Result<()> @@ -214,7 +214,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtNextEventMetadata(eventmetadataenum : EVT_HANDLE, flags : u32) -> EVT_HANDLE); let result__ = EvtNextEventMetadata(eventmetadataenum.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtNextPublisherId(publisherenum: P0, publisheridbuffer: Option<&mut [u16]>, publisheridbufferused: *mut u32) -> windows_core::Result<()> @@ -232,7 +232,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenChannelConfig(session : EVT_HANDLE, channelpath : windows_core::PCWSTR, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenChannelConfig(session.param().abi(), channelpath.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtOpenChannelEnum(session: P0, flags: u32) -> windows_core::Result @@ -241,7 +241,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenChannelEnum(session : EVT_HANDLE, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenChannelEnum(session.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtOpenEventMetadataEnum(publishermetadata: P0, flags: u32) -> windows_core::Result @@ -250,7 +250,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenEventMetadataEnum(publishermetadata : EVT_HANDLE, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenEventMetadataEnum(publishermetadata.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtOpenLog(session: P0, path: P1, flags: u32) -> windows_core::Result @@ -260,7 +260,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenLog(session : EVT_HANDLE, path : windows_core::PCWSTR, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenLog(session.param().abi(), path.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtOpenPublisherEnum(session: P0, flags: u32) -> windows_core::Result @@ -269,7 +269,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenPublisherEnum(session : EVT_HANDLE, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenPublisherEnum(session.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtOpenPublisherMetadata(session: P0, publisherid: P1, logfilepath: P2, locale: u32, flags: u32) -> windows_core::Result @@ -280,13 +280,13 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenPublisherMetadata(session : EVT_HANDLE, publisherid : windows_core::PCWSTR, logfilepath : windows_core::PCWSTR, locale : u32, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenPublisherMetadata(session.param().abi(), publisherid.param().abi(), logfilepath.param().abi(), locale, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtOpenSession(loginclass: EVT_LOGIN_CLASS, login: *const core::ffi::c_void, timeout: u32, flags: u32) -> windows_core::Result { windows_targets::link!("wevtapi.dll" "system" fn EvtOpenSession(loginclass : EVT_LOGIN_CLASS, login : *const core::ffi::c_void, timeout : u32, flags : u32) -> EVT_HANDLE); let result__ = EvtOpenSession(loginclass, login, timeout, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtQuery(session: P0, path: P1, query: P2, flags: u32) -> windows_core::Result @@ -297,7 +297,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtQuery(session : EVT_HANDLE, path : windows_core::PCWSTR, query : windows_core::PCWSTR, flags : u32) -> EVT_HANDLE); let result__ = EvtQuery(session.param().abi(), path.param().abi(), query.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtRender(context: P0, fragment: P1, flags: u32, buffersize: u32, buffer: Option<*mut core::ffi::c_void>, bufferused: *mut u32, propertycount: *mut u32) -> windows_core::Result<()> @@ -345,7 +345,7 @@ where { windows_targets::link!("wevtapi.dll" "system" fn EvtSubscribe(session : EVT_HANDLE, signalevent : super::super::Foundation:: HANDLE, channelpath : windows_core::PCWSTR, query : windows_core::PCWSTR, bookmark : EVT_HANDLE, context : *const core::ffi::c_void, callback : EVT_SUBSCRIBE_CALLBACK, flags : u32) -> EVT_HANDLE); let result__ = EvtSubscribe(session.param().abi(), signalevent.param().abi(), channelpath.param().abi(), query.param().abi(), bookmark.param().abi(), core::mem::transmute(context.unwrap_or(std::ptr::null())), callback, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn EvtUpdateBookmark(bookmark: P0, event: P1) -> windows_core::Result<()> @@ -397,7 +397,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenBackupEventLogA(lpuncservername : windows_core::PCSTR, lpfilename : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenBackupEventLogA(lpuncservername.param().abi(), lpfilename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenBackupEventLogW(lpuncservername: P0, lpfilename: P1) -> windows_core::Result @@ -407,7 +407,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenBackupEventLogW(lpuncservername : windows_core::PCWSTR, lpfilename : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenBackupEventLogW(lpuncservername.param().abi(), lpfilename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenEventLogA(lpuncservername: P0, lpsourcename: P1) -> windows_core::Result @@ -417,7 +417,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenEventLogA(lpuncservername : windows_core::PCSTR, lpsourcename : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenEventLogA(lpuncservername.param().abi(), lpsourcename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenEventLogW(lpuncservername: P0, lpsourcename: P1) -> windows_core::Result @@ -427,7 +427,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenEventLogW(lpuncservername : windows_core::PCWSTR, lpsourcename : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenEventLogW(lpuncservername.param().abi(), lpsourcename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn ReadEventLogA(heventlog: P0, dwreadflags: READ_EVENT_LOG_READ_FLAGS, dwrecordoffset: u32, lpbuffer: *mut core::ffi::c_void, nnumberofbytestoread: u32, pnbytesread: *mut u32, pnminnumberofbytesneeded: *mut u32) -> windows_core::Result<()> @@ -453,7 +453,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn RegisterEventSourceA(lpuncservername : windows_core::PCSTR, lpsourcename : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = RegisterEventSourceA(lpuncservername.param().abi(), lpsourcename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RegisterEventSourceW(lpuncservername: P0, lpsourcename: P1) -> windows_core::Result @@ -463,7 +463,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn RegisterEventSourceW(lpuncservername : windows_core::PCWSTR, lpsourcename : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = RegisterEventSourceW(lpuncservername.param().abi(), lpsourcename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] diff --git a/crates/libs/windows/src/Windows/Win32/System/GroupPolicy/mod.rs b/crates/libs/windows/src/Windows/Win32/System/GroupPolicy/mod.rs index b1ecfc3876..68b640a84c 100644 --- a/crates/libs/windows/src/Windows/Win32/System/GroupPolicy/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/GroupPolicy/mod.rs @@ -45,7 +45,7 @@ where { windows_targets::link!("userenv.dll" "system" fn EnterCriticalPolicySection(bmachine : super::super::Foundation:: BOOL) -> super::super::Foundation:: HANDLE); let result__ = EnterCriticalPolicySection(bmachine.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn ExportRSoPData(lpnamespace: P0, lpfilename: P1) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/IO/mod.rs b/crates/libs/windows/src/Windows/Win32/System/IO/mod.rs index 7bc94c5aa5..810f577a83 100644 --- a/crates/libs/windows/src/Windows/Win32/System/IO/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/IO/mod.rs @@ -38,7 +38,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateIoCompletionPort(filehandle : super::super::Foundation:: HANDLE, existingcompletionport : super::super::Foundation:: HANDLE, completionkey : usize, numberofconcurrentthreads : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateIoCompletionPort(filehandle.param().abi(), existingcompletionport.param().abi(), completionkey, numberofconcurrentthreads); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DeviceIoControl(hdevice: P0, dwiocontrolcode: u32, lpinbuffer: Option<*const core::ffi::c_void>, ninbuffersize: u32, lpoutbuffer: Option<*mut core::ffi::c_void>, noutbuffersize: u32, lpbytesreturned: Option<*mut u32>, lpoverlapped: Option<*mut OVERLAPPED>) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/JobObjects/mod.rs b/crates/libs/windows/src/Windows/Win32/System/JobObjects/mod.rs index 9eca6b12af..436a77cfe0 100644 --- a/crates/libs/windows/src/Windows/Win32/System/JobObjects/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/JobObjects/mod.rs @@ -15,7 +15,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateJobObjectA(lpjobattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateJobObjectA(core::mem::transmute(lpjobattributes.unwrap_or(std::ptr::null())), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -25,7 +25,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateJobObjectW(lpjobattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateJobObjectW(core::mem::transmute(lpjobattributes.unwrap_or(std::ptr::null())), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateJobSet(userjobset: &[JOB_SET_ARRAY], flags: u32) -> super::super::Foundation::BOOL { @@ -54,7 +54,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenJobObjectA(dwdesiredaccess : u32, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenJobObjectA(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenJobObjectW(dwdesiredaccess: u32, binherithandle: P0, lpname: P1) -> windows_core::Result @@ -64,7 +64,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenJobObjectW(dwdesiredaccess : u32, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenJobObjectW(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn QueryInformationJobObject(hjob: P0, jobobjectinformationclass: JOBOBJECTINFOCLASS, lpjobobjectinformation: *mut core::ffi::c_void, cbjobobjectinformationlength: u32, lpreturnlength: Option<*mut u32>) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/LibraryLoader/mod.rs b/crates/libs/windows/src/Windows/Win32/System/LibraryLoader/mod.rs index 1a2afacf75..b6e2354ebd 100644 --- a/crates/libs/windows/src/Windows/Win32/System/LibraryLoader/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/LibraryLoader/mod.rs @@ -14,7 +14,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn BeginUpdateResourceA(pfilename : windows_core::PCSTR, bdeleteexistingresources : super::super::Foundation:: BOOL) -> super::super::Foundation:: HANDLE); let result__ = BeginUpdateResourceA(pfilename.param().abi(), bdeleteexistingresources.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn BeginUpdateResourceW(pfilename: P0, bdeleteexistingresources: P1) -> windows_core::Result @@ -24,7 +24,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn BeginUpdateResourceW(pfilename : windows_core::PCWSTR, bdeleteexistingresources : super::super::Foundation:: BOOL) -> super::super::Foundation:: HANDLE); let result__ = BeginUpdateResourceW(pfilename.param().abi(), bdeleteexistingresources.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DisableThreadLibraryCalls(hlibmodule: P0) -> windows_core::Result<()> @@ -169,7 +169,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindResourceA(hmodule : super::super::Foundation:: HMODULE, lpname : windows_core::PCSTR, lptype : windows_core::PCSTR) -> super::super::Foundation:: HRSRC); let result__ = FindResourceA(hmodule.param().abi(), lpname.param().abi(), lptype.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindResourceExA(hmodule: P0, lptype: P1, lpname: P2, wlanguage: u16) -> windows_core::Result @@ -180,7 +180,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn FindResourceExA(hmodule : super::super::Foundation:: HMODULE, lptype : windows_core::PCSTR, lpname : windows_core::PCSTR, wlanguage : u16) -> super::super::Foundation:: HRSRC); let result__ = FindResourceExA(hmodule.param().abi(), lptype.param().abi(), lpname.param().abi(), wlanguage); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindResourceExW(hmodule: P0, lptype: P1, lpname: P2, wlanguage: u16) -> super::super::Foundation::HRSRC @@ -251,7 +251,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn GetModuleHandleA(lpmodulename : windows_core::PCSTR) -> super::super::Foundation:: HMODULE); let result__ = GetModuleHandleA(lpmodulename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetModuleHandleExA(dwflags: u32, lpmodulename: P0, phmodule: *mut super::super::Foundation::HMODULE) -> windows_core::Result<()> @@ -276,7 +276,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn GetModuleHandleW(lpmodulename : windows_core::PCWSTR) -> super::super::Foundation:: HMODULE); let result__ = GetModuleHandleW(lpmodulename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetProcAddress(hmodule: P0, lpprocname: P1) -> super::super::Foundation::FARPROC @@ -294,7 +294,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LoadLibraryA(lplibfilename : windows_core::PCSTR) -> super::super::Foundation:: HMODULE); let result__ = LoadLibraryA(lplibfilename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadLibraryExA(lplibfilename: P0, hfile: P1, dwflags: LOAD_LIBRARY_FLAGS) -> windows_core::Result @@ -304,7 +304,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LoadLibraryExA(lplibfilename : windows_core::PCSTR, hfile : super::super::Foundation:: HANDLE, dwflags : LOAD_LIBRARY_FLAGS) -> super::super::Foundation:: HMODULE); let result__ = LoadLibraryExA(lplibfilename.param().abi(), hfile.param().abi(), dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadLibraryExW(lplibfilename: P0, hfile: P1, dwflags: LOAD_LIBRARY_FLAGS) -> windows_core::Result @@ -314,7 +314,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LoadLibraryExW(lplibfilename : windows_core::PCWSTR, hfile : super::super::Foundation:: HANDLE, dwflags : LOAD_LIBRARY_FLAGS) -> super::super::Foundation:: HMODULE); let result__ = LoadLibraryExW(lplibfilename.param().abi(), hfile.param().abi(), dwflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadLibraryW(lplibfilename: P0) -> windows_core::Result @@ -323,7 +323,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LoadLibraryW(lplibfilename : windows_core::PCWSTR) -> super::super::Foundation:: HMODULE); let result__ = LoadLibraryW(lplibfilename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadModule(lpmodulename: P0, lpparameterblock: *const core::ffi::c_void) -> u32 @@ -340,7 +340,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LoadPackagedLibrary(lpwlibfilename : windows_core::PCWSTR, reserved : u32) -> super::super::Foundation:: HMODULE); let result__ = LoadPackagedLibrary(lpwlibfilename.param().abi(), reserved); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadResource(hmodule: P0, hresinfo: P1) -> windows_core::Result @@ -350,7 +350,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LoadResource(hmodule : super::super::Foundation:: HMODULE, hresinfo : super::super::Foundation:: HRSRC) -> super::super::Foundation:: HGLOBAL); let result__ = LoadResource(hmodule.param().abi(), hresinfo.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LockResource(hresdata: P0) -> *mut core::ffi::c_void diff --git a/crates/libs/windows/src/Windows/Win32/System/Mailslots/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Mailslots/mod.rs index 5a1debd7bb..113bfe7a68 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Mailslots/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Mailslots/mod.rs @@ -6,7 +6,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateMailslotA(lpname : windows_core::PCSTR, nmaxmessagesize : u32, lreadtimeout : u32, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES) -> super::super::Foundation:: HANDLE); let result__ = CreateMailslotA(lpname.param().abi(), nmaxmessagesize, lreadtimeout, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -16,7 +16,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateMailslotW(lpname : windows_core::PCWSTR, nmaxmessagesize : u32, lreadtimeout : u32, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES) -> super::super::Foundation:: HANDLE); let result__ = CreateMailslotW(lpname.param().abi(), nmaxmessagesize, lreadtimeout, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetMailslotInfo(hmailslot: P0, lpmaxmessagesize: Option<*mut u32>, lpnextsize: Option<*mut u32>, lpmessagecount: Option<*mut u32>, lpreadtimeout: Option<*mut u32>) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/Memory/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Memory/mod.rs index 37b40537c5..ab988d3890 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Memory/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Memory/mod.rs @@ -38,7 +38,7 @@ where { windows_targets::link!("api-ms-win-core-memory-l1-1-7.dll" "system" fn CreateFileMapping2(file : super::super::Foundation:: HANDLE, securityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, desiredaccess : u32, pageprotection : PAGE_PROTECTION_FLAGS, allocationattributes : u32, maximumsize : u64, name : windows_core::PCWSTR, extendedparameters : *mut MEM_EXTENDED_PARAMETER, parametercount : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateFileMapping2(file.param().abi(), core::mem::transmute(securityattributes.unwrap_or(std::ptr::null())), desiredaccess, pageprotection, allocationattributes, maximumsize, name.param().abi(), core::mem::transmute(extendedparameters.as_deref().map_or(core::ptr::null(), |slice| slice.as_ptr())), extendedparameters.as_deref().map_or(0, |slice| slice.len().try_into().unwrap())); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -49,7 +49,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingA(hfile : super::super::Foundation:: HANDLE, lpfilemappingattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, flprotect : PAGE_PROTECTION_FLAGS, dwmaximumsizehigh : u32, dwmaximumsizelow : u32, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateFileMappingA(hfile.param().abi(), core::mem::transmute(lpfilemappingattributes.unwrap_or(std::ptr::null())), flprotect, dwmaximumsizehigh, dwmaximumsizelow, lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -60,7 +60,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingFromApp(hfile : super::super::Foundation:: HANDLE, securityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, pageprotection : PAGE_PROTECTION_FLAGS, maximumsize : u64, name : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateFileMappingFromApp(hfile.param().abi(), core::mem::transmute(securityattributes.unwrap_or(std::ptr::null())), pageprotection, maximumsize, name.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -71,7 +71,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingNumaA(hfile : super::super::Foundation:: HANDLE, lpfilemappingattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, flprotect : PAGE_PROTECTION_FLAGS, dwmaximumsizehigh : u32, dwmaximumsizelow : u32, lpname : windows_core::PCSTR, nndpreferred : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateFileMappingNumaA(hfile.param().abi(), core::mem::transmute(lpfilemappingattributes.unwrap_or(std::ptr::null())), flprotect, dwmaximumsizehigh, dwmaximumsizelow, lpname.param().abi(), nndpreferred); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -82,7 +82,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingNumaW(hfile : super::super::Foundation:: HANDLE, lpfilemappingattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, flprotect : PAGE_PROTECTION_FLAGS, dwmaximumsizehigh : u32, dwmaximumsizelow : u32, lpname : windows_core::PCWSTR, nndpreferred : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateFileMappingNumaW(hfile.param().abi(), core::mem::transmute(lpfilemappingattributes.unwrap_or(std::ptr::null())), flprotect, dwmaximumsizehigh, dwmaximumsizelow, lpname.param().abi(), nndpreferred); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -93,13 +93,13 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingW(hfile : super::super::Foundation:: HANDLE, lpfilemappingattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, flprotect : PAGE_PROTECTION_FLAGS, dwmaximumsizehigh : u32, dwmaximumsizelow : u32, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateFileMappingW(hfile.param().abi(), core::mem::transmute(lpfilemappingattributes.unwrap_or(std::ptr::null())), flprotect, dwmaximumsizehigh, dwmaximumsizelow, lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateMemoryResourceNotification(notificationtype: MEMORY_RESOURCE_NOTIFICATION_TYPE) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateMemoryResourceNotification(notificationtype : MEMORY_RESOURCE_NOTIFICATION_TYPE) -> super::super::Foundation:: HANDLE); let result__ = CreateMemoryResourceNotification(notificationtype); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DiscardVirtualMemory(virtualaddress: &mut [u8]) -> u32 { @@ -133,7 +133,7 @@ pub unsafe fn GetMemoryErrorHandlingCapabilities(capabilities: *mut u32) -> wind pub unsafe fn GetProcessHeap() -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn GetProcessHeap() -> super::super::Foundation:: HANDLE); let result__ = GetProcessHeap(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetProcessHeaps(processheaps: &mut [super::super::Foundation::HANDLE]) -> u32 { @@ -162,7 +162,7 @@ pub unsafe fn GetWriteWatch(dwflags: u32, lpbaseaddress: *const core::ffi::c_voi pub unsafe fn GlobalAlloc(uflags: GLOBAL_ALLOC_FLAGS, dwbytes: usize) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn GlobalAlloc(uflags : GLOBAL_ALLOC_FLAGS, dwbytes : usize) -> super::super::Foundation:: HGLOBAL); let result__ = GlobalAlloc(uflags, dwbytes); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GlobalFlags(hmem: P0) -> u32 @@ -176,7 +176,7 @@ where pub unsafe fn GlobalHandle(pmem: *const core::ffi::c_void) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn GlobalHandle(pmem : *const core::ffi::c_void) -> super::super::Foundation:: HGLOBAL); let result__ = GlobalHandle(pmem); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GlobalLock(hmem: P0) -> *mut core::ffi::c_void @@ -193,7 +193,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn GlobalReAlloc(hmem : super::super::Foundation:: HGLOBAL, dwbytes : usize, uflags : u32) -> super::super::Foundation:: HGLOBAL); let result__ = GlobalReAlloc(hmem.param().abi(), dwbytes, uflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GlobalSize(hmem: P0) -> usize @@ -231,7 +231,7 @@ where pub unsafe fn HeapCreate(floptions: HEAP_FLAGS, dwinitialsize: usize, dwmaximumsize: usize) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn HeapCreate(floptions : HEAP_FLAGS, dwinitialsize : usize, dwmaximumsize : usize) -> super::super::Foundation:: HANDLE); let result__ = HeapCreate(floptions, dwinitialsize, dwmaximumsize); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn HeapDestroy(hheap: P0) -> windows_core::Result<()> @@ -350,7 +350,7 @@ pub unsafe fn IsBadWritePtr(lp: Option<*const core::ffi::c_void>, ucb: usize) -> pub unsafe fn LocalAlloc(uflags: LOCAL_ALLOC_FLAGS, ubytes: usize) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn LocalAlloc(uflags : LOCAL_ALLOC_FLAGS, ubytes : usize) -> super::super::Foundation:: HLOCAL); let result__ = LocalAlloc(uflags, ubytes); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LocalFlags(hmem: P0) -> u32 @@ -364,7 +364,7 @@ where pub unsafe fn LocalHandle(pmem: *const core::ffi::c_void) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn LocalHandle(pmem : *const core::ffi::c_void) -> super::super::Foundation:: HLOCAL); let result__ = LocalHandle(pmem); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LocalLock(hmem: P0) -> *mut core::ffi::c_void @@ -381,7 +381,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn LocalReAlloc(hmem : super::super::Foundation:: HLOCAL, ubytes : usize, uflags : u32) -> super::super::Foundation:: HLOCAL); let result__ = LocalReAlloc(hmem.param().abi(), ubytes, uflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LocalSize(hmem: P0) -> usize @@ -490,7 +490,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenFileMappingA(dwdesiredaccess : u32, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenFileMappingA(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenFileMappingFromApp(desiredaccess: u32, inherithandle: P0, name: P1) -> windows_core::Result @@ -500,7 +500,7 @@ where { windows_targets::link!("api-ms-win-core-memory-l1-1-3.dll" "system" fn OpenFileMappingFromApp(desiredaccess : u32, inherithandle : super::super::Foundation:: BOOL, name : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenFileMappingFromApp(desiredaccess, inherithandle.param().abi(), name.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenFileMappingW(dwdesiredaccess: u32, binherithandle: P0, lpname: P1) -> windows_core::Result @@ -510,7 +510,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenFileMappingW(dwdesiredaccess : u32, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenFileMappingW(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn PrefetchVirtualMemory(hprocess: P0, virtualaddresses: &[WIN32_MEMORY_RANGE_ENTRY], flags: u32) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/Ole/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Ole/mod.rs index 8464e32800..bd7e643dc3 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Ole/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Ole/mod.rs @@ -663,7 +663,7 @@ where { windows_targets::link!("ole32.dll" "system" fn OleMetafilePictFromIconAndLabel(hicon : super::super::UI::WindowsAndMessaging:: HICON, lpszlabel : windows_core::PCWSTR, lpszsourcefile : windows_core::PCWSTR, iiconindex : u32) -> super::super::Foundation:: HGLOBAL); let result__ = OleMetafilePictFromIconAndLabel(hicon.param().abi(), lpszlabel.param().abi(), lpszsourcefile.param().abi(), iiconindex); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OleNoteObjectVisible(punknown: P0, fvisible: P1) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/Pipes/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Pipes/mod.rs index de8bd7ba0a..2747341e74 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Pipes/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Pipes/mod.rs @@ -31,7 +31,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateNamedPipeA(lpname : windows_core::PCSTR, dwopenmode : super::super::Storage::FileSystem:: FILE_FLAGS_AND_ATTRIBUTES, dwpipemode : NAMED_PIPE_MODE, nmaxinstances : u32, noutbuffersize : u32, ninbuffersize : u32, ndefaulttimeout : u32, lpsecurityattributes : *const super::super::Security:: SECURITY_ATTRIBUTES) -> super::super::Foundation:: HANDLE); let result__ = CreateNamedPipeA(lpname.param().abi(), dwopenmode, dwpipemode, nmaxinstances, noutbuffersize, ninbuffersize, ndefaulttimeout, core::mem::transmute(lpsecurityattributes.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(all(feature = "Win32_Security", feature = "Win32_Storage_FileSystem"))] #[inline] diff --git a/crates/libs/windows/src/Windows/Win32/System/Power/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Power/mod.rs index 8e7c2934b2..515949a40d 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Power/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Power/mod.rs @@ -129,7 +129,7 @@ where pub unsafe fn PowerCreateRequest(context: *const super::Threading::REASON_CONTEXT) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn PowerCreateRequest(context : *const super::Threading:: REASON_CONTEXT) -> super::super::Foundation:: HANDLE); let result__ = PowerCreateRequest(context); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_System_Registry")] #[inline] @@ -619,7 +619,7 @@ where { windows_targets::link!("user32.dll" "system" fn RegisterPowerSettingNotification(hrecipient : super::super::Foundation:: HANDLE, powersettingguid : *const windows_core::GUID, flags : super::super::UI::WindowsAndMessaging:: REGISTER_NOTIFICATION_FLAGS) -> HPOWERNOTIFY); let result__ = RegisterPowerSettingNotification(hrecipient.param().abi(), powersettingguid, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_UI_WindowsAndMessaging")] #[inline] @@ -629,7 +629,7 @@ where { windows_targets::link!("user32.dll" "system" fn RegisterSuspendResumeNotification(hrecipient : super::super::Foundation:: HANDLE, flags : super::super::UI::WindowsAndMessaging:: REGISTER_NOTIFICATION_FLAGS) -> HPOWERNOTIFY); let result__ = RegisterSuspendResumeNotification(hrecipient.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RequestWakeupLatency(latency: LATENCY_TIME) -> super::super::Foundation::BOOL { diff --git a/crates/libs/windows/src/Windows/Win32/System/RemoteDesktop/mod.rs b/crates/libs/windows/src/Windows/Win32/System/RemoteDesktop/mod.rs index 6fac9791cd..0a3024a898 100644 --- a/crates/libs/windows/src/Windows/Win32/System/RemoteDesktop/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/RemoteDesktop/mod.rs @@ -468,7 +468,7 @@ where { windows_targets::link!("wtsapi32.dll" "system" fn WTSVirtualChannelOpen(hserver : super::super::Foundation:: HANDLE, sessionid : u32, pvirtualname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = WTSVirtualChannelOpen(hserver.param().abi(), sessionid, pvirtualname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WTSVirtualChannelOpenEx(sessionid: u32, pvirtualname: P0, flags: u32) -> windows_core::Result @@ -477,7 +477,7 @@ where { windows_targets::link!("wtsapi32.dll" "system" fn WTSVirtualChannelOpenEx(sessionid : u32, pvirtualname : windows_core::PCSTR, flags : u32) -> super::super::Foundation:: HANDLE); let result__ = WTSVirtualChannelOpenEx(sessionid, pvirtualname.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn WTSVirtualChannelPurgeInput(hchannelhandle: P0) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/Services/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Services/mod.rs index 23df6d8914..3ec4c485a3 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Services/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Services/mod.rs @@ -88,7 +88,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn CreateServiceA(hscmanager : SC_HANDLE, lpservicename : windows_core::PCSTR, lpdisplayname : windows_core::PCSTR, dwdesiredaccess : u32, dwservicetype : ENUM_SERVICE_TYPE, dwstarttype : SERVICE_START_TYPE, dwerrorcontrol : SERVICE_ERROR, lpbinarypathname : windows_core::PCSTR, lploadordergroup : windows_core::PCSTR, lpdwtagid : *mut u32, lpdependencies : windows_core::PCSTR, lpservicestartname : windows_core::PCSTR, lppassword : windows_core::PCSTR) -> SC_HANDLE); let result__ = CreateServiceA(hscmanager.param().abi(), lpservicename.param().abi(), lpdisplayname.param().abi(), dwdesiredaccess, dwservicetype, dwstarttype, dwerrorcontrol, lpbinarypathname.param().abi(), lploadordergroup.param().abi(), core::mem::transmute(lpdwtagid.unwrap_or(std::ptr::null_mut())), lpdependencies.param().abi(), lpservicestartname.param().abi(), lppassword.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateServiceW(hscmanager: P0, lpservicename: P1, lpdisplayname: P2, dwdesiredaccess: u32, dwservicetype: ENUM_SERVICE_TYPE, dwstarttype: SERVICE_START_TYPE, dwerrorcontrol: SERVICE_ERROR, lpbinarypathname: P3, lploadordergroup: P4, lpdwtagid: Option<*mut u32>, lpdependencies: P5, lpservicestartname: P6, lppassword: P7) -> windows_core::Result @@ -104,7 +104,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn CreateServiceW(hscmanager : SC_HANDLE, lpservicename : windows_core::PCWSTR, lpdisplayname : windows_core::PCWSTR, dwdesiredaccess : u32, dwservicetype : ENUM_SERVICE_TYPE, dwstarttype : SERVICE_START_TYPE, dwerrorcontrol : SERVICE_ERROR, lpbinarypathname : windows_core::PCWSTR, lploadordergroup : windows_core::PCWSTR, lpdwtagid : *mut u32, lpdependencies : windows_core::PCWSTR, lpservicestartname : windows_core::PCWSTR, lppassword : windows_core::PCWSTR) -> SC_HANDLE); let result__ = CreateServiceW(hscmanager.param().abi(), lpservicename.param().abi(), lpdisplayname.param().abi(), dwdesiredaccess, dwservicetype, dwstarttype, dwerrorcontrol, lpbinarypathname.param().abi(), lploadordergroup.param().abi(), core::mem::transmute(lpdwtagid.unwrap_or(std::ptr::null_mut())), lpdependencies.param().abi(), lpservicestartname.param().abi(), lppassword.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DeleteService(hservice: P0) -> windows_core::Result<()> @@ -274,7 +274,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenSCManagerA(lpmachinename : windows_core::PCSTR, lpdatabasename : windows_core::PCSTR, dwdesiredaccess : u32) -> SC_HANDLE); let result__ = OpenSCManagerA(lpmachinename.param().abi(), lpdatabasename.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenSCManagerW(lpmachinename: P0, lpdatabasename: P1, dwdesiredaccess: u32) -> windows_core::Result @@ -284,7 +284,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenSCManagerW(lpmachinename : windows_core::PCWSTR, lpdatabasename : windows_core::PCWSTR, dwdesiredaccess : u32) -> SC_HANDLE); let result__ = OpenSCManagerW(lpmachinename.param().abi(), lpdatabasename.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenServiceA(hscmanager: P0, lpservicename: P1, dwdesiredaccess: u32) -> windows_core::Result @@ -294,7 +294,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenServiceA(hscmanager : SC_HANDLE, lpservicename : windows_core::PCSTR, dwdesiredaccess : u32) -> SC_HANDLE); let result__ = OpenServiceA(hscmanager.param().abi(), lpservicename.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenServiceW(hscmanager: P0, lpservicename: P1, dwdesiredaccess: u32) -> windows_core::Result @@ -304,7 +304,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn OpenServiceW(hscmanager : SC_HANDLE, lpservicename : windows_core::PCWSTR, dwdesiredaccess : u32) -> SC_HANDLE); let result__ = OpenServiceW(hscmanager.param().abi(), lpservicename.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn QueryServiceConfig2A(hservice: P0, dwinfolevel: SERVICE_CONFIG, lpbuffer: Option<&mut [u8]>, pcbbytesneeded: *mut u32) -> windows_core::Result<()> @@ -394,7 +394,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn RegisterServiceCtrlHandlerA(lpservicename : windows_core::PCSTR, lphandlerproc : LPHANDLER_FUNCTION) -> SERVICE_STATUS_HANDLE); let result__ = RegisterServiceCtrlHandlerA(lpservicename.param().abi(), lphandlerproc); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RegisterServiceCtrlHandlerExA(lpservicename: P0, lphandlerproc: LPHANDLER_FUNCTION_EX, lpcontext: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -403,7 +403,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn RegisterServiceCtrlHandlerExA(lpservicename : windows_core::PCSTR, lphandlerproc : LPHANDLER_FUNCTION_EX, lpcontext : *const core::ffi::c_void) -> SERVICE_STATUS_HANDLE); let result__ = RegisterServiceCtrlHandlerExA(lpservicename.param().abi(), lphandlerproc, core::mem::transmute(lpcontext.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RegisterServiceCtrlHandlerExW(lpservicename: P0, lphandlerproc: LPHANDLER_FUNCTION_EX, lpcontext: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -412,7 +412,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn RegisterServiceCtrlHandlerExW(lpservicename : windows_core::PCWSTR, lphandlerproc : LPHANDLER_FUNCTION_EX, lpcontext : *const core::ffi::c_void) -> SERVICE_STATUS_HANDLE); let result__ = RegisterServiceCtrlHandlerExW(lpservicename.param().abi(), lphandlerproc, core::mem::transmute(lpcontext.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RegisterServiceCtrlHandlerW(lpservicename: P0, lphandlerproc: LPHANDLER_FUNCTION) -> windows_core::Result @@ -421,7 +421,7 @@ where { windows_targets::link!("advapi32.dll" "system" fn RegisterServiceCtrlHandlerW(lpservicename : windows_core::PCWSTR, lphandlerproc : LPHANDLER_FUNCTION) -> SERVICE_STATUS_HANDLE); let result__ = RegisterServiceCtrlHandlerW(lpservicename.param().abi(), lphandlerproc); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetServiceBits(hservicestatus: P0, dwservicebits: u32, bsetbitson: P1, bupdateimmediately: P2) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/StationsAndDesktops/mod.rs b/crates/libs/windows/src/Windows/Win32/System/StationsAndDesktops/mod.rs index 0c4356909b..7b2d4d7451 100644 --- a/crates/libs/windows/src/Windows/Win32/System/StationsAndDesktops/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/StationsAndDesktops/mod.rs @@ -59,7 +59,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDesktopA(lpszdesktop : windows_core::PCSTR, lpszdevice : windows_core::PCSTR, pdevmode : *const super::super::Graphics::Gdi:: DEVMODEA, dwflags : DESKTOP_CONTROL_FLAGS, dwdesiredaccess : u32, lpsa : *const super::super::Security:: SECURITY_ATTRIBUTES) -> HDESK); let result__ = CreateDesktopA(lpszdesktop.param().abi(), lpszdevice.param().abi(), core::mem::transmute(pdevmode.unwrap_or(std::ptr::null())), dwflags, dwdesiredaccess, core::mem::transmute(lpsa.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(all(feature = "Win32_Graphics_Gdi", feature = "Win32_Security"))] #[inline] @@ -70,7 +70,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDesktopExA(lpszdesktop : windows_core::PCSTR, lpszdevice : windows_core::PCSTR, pdevmode : *const super::super::Graphics::Gdi:: DEVMODEA, dwflags : DESKTOP_CONTROL_FLAGS, dwdesiredaccess : u32, lpsa : *const super::super::Security:: SECURITY_ATTRIBUTES, ulheapsize : u32, pvoid : *const core::ffi::c_void) -> HDESK); let result__ = CreateDesktopExA(lpszdesktop.param().abi(), lpszdevice.param().abi(), core::mem::transmute(pdevmode.unwrap_or(std::ptr::null())), dwflags, dwdesiredaccess, core::mem::transmute(lpsa.unwrap_or(std::ptr::null())), ulheapsize, core::mem::transmute(pvoid.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(all(feature = "Win32_Graphics_Gdi", feature = "Win32_Security"))] #[inline] @@ -81,7 +81,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDesktopExW(lpszdesktop : windows_core::PCWSTR, lpszdevice : windows_core::PCWSTR, pdevmode : *const super::super::Graphics::Gdi:: DEVMODEW, dwflags : DESKTOP_CONTROL_FLAGS, dwdesiredaccess : u32, lpsa : *const super::super::Security:: SECURITY_ATTRIBUTES, ulheapsize : u32, pvoid : *const core::ffi::c_void) -> HDESK); let result__ = CreateDesktopExW(lpszdesktop.param().abi(), lpszdevice.param().abi(), core::mem::transmute(pdevmode.unwrap_or(std::ptr::null())), dwflags, dwdesiredaccess, core::mem::transmute(lpsa.unwrap_or(std::ptr::null())), ulheapsize, core::mem::transmute(pvoid.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(all(feature = "Win32_Graphics_Gdi", feature = "Win32_Security"))] #[inline] @@ -92,7 +92,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDesktopW(lpszdesktop : windows_core::PCWSTR, lpszdevice : windows_core::PCWSTR, pdevmode : *const super::super::Graphics::Gdi:: DEVMODEW, dwflags : DESKTOP_CONTROL_FLAGS, dwdesiredaccess : u32, lpsa : *const super::super::Security:: SECURITY_ATTRIBUTES) -> HDESK); let result__ = CreateDesktopW(lpszdesktop.param().abi(), lpszdevice.param().abi(), core::mem::transmute(pdevmode.unwrap_or(std::ptr::null())), dwflags, dwdesiredaccess, core::mem::transmute(lpsa.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -102,7 +102,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateWindowStationA(lpwinsta : windows_core::PCSTR, dwflags : u32, dwdesiredaccess : u32, lpsa : *const super::super::Security:: SECURITY_ATTRIBUTES) -> HWINSTA); let result__ = CreateWindowStationA(lpwinsta.param().abi(), dwflags, dwdesiredaccess, core::mem::transmute(lpsa.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -112,7 +112,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateWindowStationW(lpwinsta : windows_core::PCWSTR, dwflags : u32, dwdesiredaccess : u32, lpsa : *const super::super::Security:: SECURITY_ATTRIBUTES) -> HWINSTA); let result__ = CreateWindowStationW(lpwinsta.param().abi(), dwflags, dwdesiredaccess, core::mem::transmute(lpsa.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_UI_WindowsAndMessaging")] #[inline] @@ -162,13 +162,13 @@ where pub unsafe fn GetProcessWindowStation() -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn GetProcessWindowStation() -> HWINSTA); let result__ = GetProcessWindowStation(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetThreadDesktop(dwthreadid: u32) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn GetThreadDesktop(dwthreadid : u32) -> HDESK); let result__ = GetThreadDesktop(dwthreadid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetUserObjectInformationA(hobj: P0, nindex: USER_OBJECT_INFORMATION_INDEX, pvinfo: Option<*mut core::ffi::c_void>, nlength: u32, lpnlengthneeded: Option<*mut u32>) -> windows_core::Result<()> @@ -194,7 +194,7 @@ where { windows_targets::link!("user32.dll" "system" fn OpenDesktopA(lpszdesktop : windows_core::PCSTR, dwflags : DESKTOP_CONTROL_FLAGS, finherit : super::super::Foundation:: BOOL, dwdesiredaccess : u32) -> HDESK); let result__ = OpenDesktopA(lpszdesktop.param().abi(), dwflags, finherit.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenDesktopW(lpszdesktop: P0, dwflags: DESKTOP_CONTROL_FLAGS, finherit: P1, dwdesiredaccess: u32) -> windows_core::Result @@ -204,7 +204,7 @@ where { windows_targets::link!("user32.dll" "system" fn OpenDesktopW(lpszdesktop : windows_core::PCWSTR, dwflags : DESKTOP_CONTROL_FLAGS, finherit : super::super::Foundation:: BOOL, dwdesiredaccess : u32) -> HDESK); let result__ = OpenDesktopW(lpszdesktop.param().abi(), dwflags, finherit.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenInputDesktop(dwflags: DESKTOP_CONTROL_FLAGS, finherit: P0, dwdesiredaccess: DESKTOP_ACCESS_FLAGS) -> windows_core::Result @@ -213,7 +213,7 @@ where { windows_targets::link!("user32.dll" "system" fn OpenInputDesktop(dwflags : DESKTOP_CONTROL_FLAGS, finherit : super::super::Foundation:: BOOL, dwdesiredaccess : DESKTOP_ACCESS_FLAGS) -> HDESK); let result__ = OpenInputDesktop(dwflags, finherit.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenWindowStationA(lpszwinsta: P0, finherit: P1, dwdesiredaccess: u32) -> windows_core::Result @@ -223,7 +223,7 @@ where { windows_targets::link!("user32.dll" "system" fn OpenWindowStationA(lpszwinsta : windows_core::PCSTR, finherit : super::super::Foundation:: BOOL, dwdesiredaccess : u32) -> HWINSTA); let result__ = OpenWindowStationA(lpszwinsta.param().abi(), finherit.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenWindowStationW(lpszwinsta: P0, finherit: P1, dwdesiredaccess: u32) -> windows_core::Result @@ -233,7 +233,7 @@ where { windows_targets::link!("user32.dll" "system" fn OpenWindowStationW(lpszwinsta : windows_core::PCWSTR, finherit : super::super::Foundation:: BOOL, dwdesiredaccess : u32) -> HWINSTA); let result__ = OpenWindowStationW(lpszwinsta.param().abi(), finherit.param().abi(), dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetProcessWindowStation(hwinsta: P0) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/System/Threading/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Threading/mod.rs index efe38d49e5..bfa8347b10 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Threading/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Threading/mod.rs @@ -111,7 +111,7 @@ where { windows_targets::link!("avrt.dll" "system" fn AvSetMmMaxThreadCharacteristicsA(firsttask : windows_core::PCSTR, secondtask : windows_core::PCSTR, taskindex : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = AvSetMmMaxThreadCharacteristicsA(firsttask.param().abi(), secondtask.param().abi(), taskindex); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn AvSetMmMaxThreadCharacteristicsW(firsttask: P0, secondtask: P1, taskindex: *mut u32) -> windows_core::Result @@ -121,7 +121,7 @@ where { windows_targets::link!("avrt.dll" "system" fn AvSetMmMaxThreadCharacteristicsW(firsttask : windows_core::PCWSTR, secondtask : windows_core::PCWSTR, taskindex : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = AvSetMmMaxThreadCharacteristicsW(firsttask.param().abi(), secondtask.param().abi(), taskindex); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn AvSetMmThreadCharacteristicsA(taskname: P0, taskindex: *mut u32) -> windows_core::Result @@ -130,7 +130,7 @@ where { windows_targets::link!("avrt.dll" "system" fn AvSetMmThreadCharacteristicsA(taskname : windows_core::PCSTR, taskindex : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = AvSetMmThreadCharacteristicsA(taskname.param().abi(), taskindex); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn AvSetMmThreadCharacteristicsW(taskname: P0, taskindex: *mut u32) -> windows_core::Result @@ -139,7 +139,7 @@ where { windows_targets::link!("avrt.dll" "system" fn AvSetMmThreadCharacteristicsW(taskname : windows_core::PCWSTR, taskindex : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = AvSetMmThreadCharacteristicsW(taskname.param().abi(), taskindex); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn AvSetMmThreadPriority(avrthandle: P0, priority: AVRT_PRIORITY) -> windows_core::Result<()> @@ -277,7 +277,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateBoundaryDescriptorA(name : windows_core::PCSTR, flags : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateBoundaryDescriptorA(name.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateBoundaryDescriptorW(name: P0, flags: u32) -> super::super::Foundation::HANDLE @@ -297,7 +297,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateEventA(lpeventattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, bmanualreset : super::super::Foundation:: BOOL, binitialstate : super::super::Foundation:: BOOL, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateEventA(core::mem::transmute(lpeventattributes.unwrap_or(std::ptr::null())), bmanualreset.param().abi(), binitialstate.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -307,7 +307,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateEventExA(lpeventattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpname : windows_core::PCSTR, dwflags : CREATE_EVENT, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateEventExA(core::mem::transmute(lpeventattributes.unwrap_or(std::ptr::null())), lpname.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -317,7 +317,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateEventExW(lpeventattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpname : windows_core::PCWSTR, dwflags : CREATE_EVENT, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateEventExW(core::mem::transmute(lpeventattributes.unwrap_or(std::ptr::null())), lpname.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -329,7 +329,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateEventW(lpeventattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, bmanualreset : super::super::Foundation:: BOOL, binitialstate : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateEventW(core::mem::transmute(lpeventattributes.unwrap_or(std::ptr::null())), bmanualreset.param().abi(), binitialstate.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateFiber(dwstacksize: usize, lpstartaddress: LPFIBER_START_ROUTINE, lpparameter: Option<*const core::ffi::c_void>) -> *mut core::ffi::c_void { @@ -350,7 +350,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateMutexA(lpmutexattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, binitialowner : super::super::Foundation:: BOOL, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateMutexA(core::mem::transmute(lpmutexattributes.unwrap_or(std::ptr::null())), binitialowner.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -360,7 +360,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateMutexExA(lpmutexattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpname : windows_core::PCSTR, dwflags : u32, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateMutexExA(core::mem::transmute(lpmutexattributes.unwrap_or(std::ptr::null())), lpname.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -370,7 +370,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateMutexExW(lpmutexattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpname : windows_core::PCWSTR, dwflags : u32, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateMutexExW(core::mem::transmute(lpmutexattributes.unwrap_or(std::ptr::null())), lpname.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -381,7 +381,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateMutexW(lpmutexattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, binitialowner : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateMutexW(core::mem::transmute(lpmutexattributes.unwrap_or(std::ptr::null())), binitialowner.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -391,7 +391,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreatePrivateNamespaceA(lpprivatenamespaceattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lpboundarydescriptor : *const core::ffi::c_void, lpaliasprefix : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = CreatePrivateNamespaceA(core::mem::transmute(lpprivatenamespaceattributes.unwrap_or(std::ptr::null())), lpboundarydescriptor, lpaliasprefix.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -478,7 +478,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateRemoteThread(hprocess : super::super::Foundation:: HANDLE, lpthreadattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwstacksize : usize, lpstartaddress : LPTHREAD_START_ROUTINE, lpparameter : *const core::ffi::c_void, dwcreationflags : u32, lpthreadid : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = CreateRemoteThread(hprocess.param().abi(), core::mem::transmute(lpthreadattributes.unwrap_or(std::ptr::null())), dwstacksize, lpstartaddress, core::mem::transmute(lpparameter.unwrap_or(std::ptr::null())), dwcreationflags, core::mem::transmute(lpthreadid.unwrap_or(std::ptr::null_mut()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -489,7 +489,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateRemoteThreadEx(hprocess : super::super::Foundation:: HANDLE, lpthreadattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwstacksize : usize, lpstartaddress : LPTHREAD_START_ROUTINE, lpparameter : *const core::ffi::c_void, dwcreationflags : u32, lpattributelist : LPPROC_THREAD_ATTRIBUTE_LIST, lpthreadid : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = CreateRemoteThreadEx(hprocess.param().abi(), core::mem::transmute(lpthreadattributes.unwrap_or(std::ptr::null())), dwstacksize, lpstartaddress, core::mem::transmute(lpparameter.unwrap_or(std::ptr::null())), dwcreationflags, lpattributelist.param().abi(), core::mem::transmute(lpthreadid.unwrap_or(std::ptr::null_mut()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -499,7 +499,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateSemaphoreA(lpsemaphoreattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, linitialcount : i32, lmaximumcount : i32, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateSemaphoreA(core::mem::transmute(lpsemaphoreattributes.unwrap_or(std::ptr::null())), linitialcount, lmaximumcount, lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -509,7 +509,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateSemaphoreExA(lpsemaphoreattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, linitialcount : i32, lmaximumcount : i32, lpname : windows_core::PCSTR, dwflags : u32, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateSemaphoreExA(core::mem::transmute(lpsemaphoreattributes.unwrap_or(std::ptr::null())), linitialcount, lmaximumcount, lpname.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -519,7 +519,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateSemaphoreExW(lpsemaphoreattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, linitialcount : i32, lmaximumcount : i32, lpname : windows_core::PCWSTR, dwflags : u32, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateSemaphoreExW(core::mem::transmute(lpsemaphoreattributes.unwrap_or(std::ptr::null())), linitialcount, lmaximumcount, lpname.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -529,26 +529,26 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateSemaphoreW(lpsemaphoreattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, linitialcount : i32, lmaximumcount : i32, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateSemaphoreW(core::mem::transmute(lpsemaphoreattributes.unwrap_or(std::ptr::null())), linitialcount, lmaximumcount, lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] pub unsafe fn CreateThread(lpthreadattributes: Option<*const super::super::Security::SECURITY_ATTRIBUTES>, dwstacksize: usize, lpstartaddress: LPTHREAD_START_ROUTINE, lpparameter: Option<*const core::ffi::c_void>, dwcreationflags: THREAD_CREATION_FLAGS, lpthreadid: Option<*mut u32>) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateThread(lpthreadattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, dwstacksize : usize, lpstartaddress : LPTHREAD_START_ROUTINE, lpparameter : *const core::ffi::c_void, dwcreationflags : THREAD_CREATION_FLAGS, lpthreadid : *mut u32) -> super::super::Foundation:: HANDLE); let result__ = CreateThread(core::mem::transmute(lpthreadattributes.unwrap_or(std::ptr::null())), dwstacksize, lpstartaddress, core::mem::transmute(lpparameter.unwrap_or(std::ptr::null())), dwcreationflags, core::mem::transmute(lpthreadid.unwrap_or(std::ptr::null_mut()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateThreadpool(reserved: Option<*const core::ffi::c_void>) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateThreadpool(reserved : *const core::ffi::c_void) -> PTP_POOL); let result__ = CreateThreadpool(core::mem::transmute(reserved.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateThreadpoolCleanupGroup() -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateThreadpoolCleanupGroup() -> PTP_CLEANUP_GROUP); let result__ = CreateThreadpoolCleanupGroup(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateThreadpoolIo(fl: P0, pfnio: PTP_WIN32_IO_CALLBACK, pv: Option<*mut core::ffi::c_void>, pcbe: Option<*const TP_CALLBACK_ENVIRON_V3>) -> windows_core::Result @@ -557,31 +557,31 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateThreadpoolIo(fl : super::super::Foundation:: HANDLE, pfnio : PTP_WIN32_IO_CALLBACK, pv : *mut core::ffi::c_void, pcbe : *const TP_CALLBACK_ENVIRON_V3) -> PTP_IO); let result__ = CreateThreadpoolIo(fl.param().abi(), pfnio, core::mem::transmute(pv.unwrap_or(std::ptr::null_mut())), core::mem::transmute(pcbe.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateThreadpoolTimer(pfnti: PTP_TIMER_CALLBACK, pv: Option<*mut core::ffi::c_void>, pcbe: Option<*const TP_CALLBACK_ENVIRON_V3>) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateThreadpoolTimer(pfnti : PTP_TIMER_CALLBACK, pv : *mut core::ffi::c_void, pcbe : *const TP_CALLBACK_ENVIRON_V3) -> PTP_TIMER); let result__ = CreateThreadpoolTimer(pfnti, core::mem::transmute(pv.unwrap_or(std::ptr::null_mut())), core::mem::transmute(pcbe.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateThreadpoolWait(pfnwa: PTP_WAIT_CALLBACK, pv: Option<*mut core::ffi::c_void>, pcbe: Option<*const TP_CALLBACK_ENVIRON_V3>) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateThreadpoolWait(pfnwa : PTP_WAIT_CALLBACK, pv : *mut core::ffi::c_void, pcbe : *const TP_CALLBACK_ENVIRON_V3) -> PTP_WAIT); let result__ = CreateThreadpoolWait(pfnwa, core::mem::transmute(pv.unwrap_or(std::ptr::null_mut())), core::mem::transmute(pcbe.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateThreadpoolWork(pfnwk: PTP_WORK_CALLBACK, pv: Option<*mut core::ffi::c_void>, pcbe: Option<*const TP_CALLBACK_ENVIRON_V3>) -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateThreadpoolWork(pfnwk : PTP_WORK_CALLBACK, pv : *mut core::ffi::c_void, pcbe : *const TP_CALLBACK_ENVIRON_V3) -> PTP_WORK); let result__ = CreateThreadpoolWork(pfnwk, core::mem::transmute(pv.unwrap_or(std::ptr::null_mut())), core::mem::transmute(pcbe.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateTimerQueue() -> windows_core::Result { windows_targets::link!("kernel32.dll" "system" fn CreateTimerQueue() -> super::super::Foundation:: HANDLE); let result__ = CreateTimerQueue(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateTimerQueueTimer(phnewtimer: *mut super::super::Foundation::HANDLE, timerqueue: P0, callback: WAITORTIMERCALLBACK, parameter: Option<*const core::ffi::c_void>, duetime: u32, period: u32, flags: WORKER_THREAD_FLAGS) -> windows_core::Result<()> @@ -628,7 +628,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateWaitableTimerExW(lptimerattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, lptimername : windows_core::PCWSTR, dwflags : u32, dwdesiredaccess : u32) -> super::super::Foundation:: HANDLE); let result__ = CreateWaitableTimerExW(core::mem::transmute(lptimerattributes.unwrap_or(std::ptr::null())), lptimername.param().abi(), dwflags, dwdesiredaccess); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -639,7 +639,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn CreateWaitableTimerW(lptimerattributes : *const super::super::Security:: SECURITY_ATTRIBUTES, bmanualreset : super::super::Foundation:: BOOL, lptimername : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = CreateWaitableTimerW(core::mem::transmute(lptimerattributes.unwrap_or(std::ptr::null())), bmanualreset.param().abi(), lptimername.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DeleteBoundaryDescriptor(boundarydescriptor: P0) @@ -1374,7 +1374,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenEventA(dwdesiredaccess : SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenEventA(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenEventW(dwdesiredaccess: SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle: P0, lpname: P1) -> windows_core::Result @@ -1384,7 +1384,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenEventW(dwdesiredaccess : SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenEventW(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenMutexW(dwdesiredaccess: SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle: P0, lpname: P1) -> windows_core::Result @@ -1394,7 +1394,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenMutexW(dwdesiredaccess : SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenMutexW(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenPrivateNamespaceA(lpboundarydescriptor: *const core::ffi::c_void, lpaliasprefix: P0) -> super::super::Foundation::HANDLE @@ -1419,7 +1419,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenProcess(dwdesiredaccess : PROCESS_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, dwprocessid : u32) -> super::super::Foundation:: HANDLE); let result__ = OpenProcess(dwdesiredaccess, binherithandle.param().abi(), dwprocessid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -1438,7 +1438,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenSemaphoreW(dwdesiredaccess : SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, lpname : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenSemaphoreW(dwdesiredaccess, binherithandle.param().abi(), lpname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn OpenThread(dwdesiredaccess: THREAD_ACCESS_RIGHTS, binherithandle: P0, dwthreadid: u32) -> windows_core::Result @@ -1447,7 +1447,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenThread(dwdesiredaccess : THREAD_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, dwthreadid : u32) -> super::super::Foundation:: HANDLE); let result__ = OpenThread(dwdesiredaccess, binherithandle.param().abi(), dwthreadid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Security")] #[inline] @@ -1476,7 +1476,7 @@ where { windows_targets::link!("kernel32.dll" "system" fn OpenWaitableTimerW(dwdesiredaccess : SYNCHRONIZATION_ACCESS_RIGHTS, binherithandle : super::super::Foundation:: BOOL, lptimername : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = OpenWaitableTimerW(dwdesiredaccess, binherithandle.param().abi(), lptimername.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn PulseEvent(hevent: P0) -> windows_core::Result<()> diff --git a/crates/libs/windows/src/Windows/Win32/UI/Controls/mod.rs b/crates/libs/windows/src/Windows/Win32/UI/Controls/mod.rs index ddcff3a1e3..ebab967391 100644 --- a/crates/libs/windows/src/Windows/Win32/UI/Controls/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/UI/Controls/mod.rs @@ -99,7 +99,7 @@ where { windows_targets::link!("comctl32.dll" "system" fn CreateMappedBitmap(hinstance : super::super::Foundation:: HINSTANCE, idbitmap : isize, wflags : u32, lpcolormap : *const COLORMAP, inummaps : i32) -> super::super::Graphics::Gdi:: HBITMAP); let result__ = CreateMappedBitmap(hinstance.param().abi(), idbitmap, wflags, core::mem::transmute(lpcolormap.unwrap_or(std::ptr::null())), inummaps); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(all(feature = "Win32_Graphics_Gdi", feature = "Win32_UI_WindowsAndMessaging"))] #[inline] @@ -121,7 +121,7 @@ where { windows_targets::link!("comctl32.dll" "system" fn CreateStatusWindowA(style : i32, lpsztext : windows_core::PCSTR, hwndparent : super::super::Foundation:: HWND, wid : u32) -> super::super::Foundation:: HWND); let result__ = CreateStatusWindowA(style, lpsztext.param().abi(), hwndparent.param().abi(), wid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateStatusWindowW(style: i32, lpsztext: P0, hwndparent: P1, wid: u32) -> windows_core::Result @@ -131,14 +131,14 @@ where { windows_targets::link!("comctl32.dll" "system" fn CreateStatusWindowW(style : i32, lpsztext : windows_core::PCWSTR, hwndparent : super::super::Foundation:: HWND, wid : u32) -> super::super::Foundation:: HWND); let result__ = CreateStatusWindowW(style, lpsztext.param().abi(), hwndparent.param().abi(), wid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_UI_WindowsAndMessaging")] #[inline] pub unsafe fn CreateSyntheticPointerDevice(pointertype: super::WindowsAndMessaging::POINTER_INPUT_TYPE, maxcount: u32, mode: POINTER_FEEDBACK_MODE) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn CreateSyntheticPointerDevice(pointertype : super::WindowsAndMessaging:: POINTER_INPUT_TYPE, maxcount : u32, mode : POINTER_FEEDBACK_MODE) -> HSYNTHETICPOINTERDEVICE); let result__ = CreateSyntheticPointerDevice(pointertype, maxcount, mode); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateToolbarEx(hwnd: P0, ws: u32, wid: u32, nbitmaps: i32, hbminst: P1, wbmid: usize, lpbuttons: *mut TBBUTTON, inumbuttons: i32, dxbutton: i32, dybutton: i32, dxbitmap: i32, dybitmap: i32, ustructsize: u32) -> windows_core::Result @@ -148,7 +148,7 @@ where { windows_targets::link!("comctl32.dll" "system" fn CreateToolbarEx(hwnd : super::super::Foundation:: HWND, ws : u32, wid : u32, nbitmaps : i32, hbminst : super::super::Foundation:: HINSTANCE, wbmid : usize, lpbuttons : *mut TBBUTTON, inumbuttons : i32, dxbutton : i32, dybutton : i32, dxbitmap : i32, dybitmap : i32, ustructsize : u32) -> super::super::Foundation:: HWND); let result__ = CreateToolbarEx(hwnd.param().abi(), ws, wid, nbitmaps, hbminst.param().abi(), wbmid, lpbuttons, inumbuttons, dxbutton, dybutton, dxbitmap, dybitmap, ustructsize); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateUpDownControl(dwstyle: u32, x: i32, y: i32, cx: i32, cy: i32, hparent: P0, nid: i32, hinst: P1, hbuddy: P2, nupper: i32, nlower: i32, npos: i32) -> super::super::Foundation::HWND diff --git a/crates/libs/windows/src/Windows/Win32/UI/Input/KeyboardAndMouse/mod.rs b/crates/libs/windows/src/Windows/Win32/UI/Input/KeyboardAndMouse/mod.rs index a91f90ee29..38c652abe9 100644 --- a/crates/libs/windows/src/Windows/Win32/UI/Input/KeyboardAndMouse/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/UI/Input/KeyboardAndMouse/mod.rs @@ -5,7 +5,7 @@ where { windows_targets::link!("user32.dll" "system" fn ActivateKeyboardLayout(hkl : HKL, flags : ACTIVATE_KEYBOARD_LAYOUT_FLAGS) -> HKL); let result__ = ActivateKeyboardLayout(hkl.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn BlockInput(fblockit: P0) -> windows_core::Result<()> @@ -132,7 +132,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadKeyboardLayoutA(pwszklid : windows_core::PCSTR, flags : ACTIVATE_KEYBOARD_LAYOUT_FLAGS) -> HKL); let result__ = LoadKeyboardLayoutA(pwszklid.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadKeyboardLayoutW(pwszklid: P0, flags: ACTIVATE_KEYBOARD_LAYOUT_FLAGS) -> windows_core::Result @@ -141,7 +141,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadKeyboardLayoutW(pwszklid : windows_core::PCWSTR, flags : ACTIVATE_KEYBOARD_LAYOUT_FLAGS) -> HKL); let result__ = LoadKeyboardLayoutW(pwszklid.param().abi(), flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn MapVirtualKeyA(ucode: u32, umaptype: MAP_VIRTUAL_KEY_TYPE) -> u32 { @@ -199,7 +199,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetActiveWindow(hwnd : super::super::super::Foundation:: HWND) -> super::super::super::Foundation:: HWND); let result__ = SetActiveWindow(hwnd.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetCapture(hwnd: P0) -> super::super::super::Foundation::HWND @@ -221,7 +221,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetFocus(hwnd : super::super::super::Foundation:: HWND) -> super::super::super::Foundation:: HWND); let result__ = SetFocus(hwnd.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetKeyboardState(lpkeystate: &[u8; 256]) -> windows_core::Result<()> { diff --git a/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs b/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs index af4404cfc0..de9c001724 100644 --- a/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs @@ -62,7 +62,7 @@ where pub unsafe fn BeginDeferWindowPos(nnumwindows: i32) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn BeginDeferWindowPos(nnumwindows : i32) -> HDWP); let result__ = BeginDeferWindowPos(nnumwindows); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn BringWindowToTop(hwnd: P0) -> windows_core::Result<()> @@ -352,7 +352,7 @@ where { windows_targets::link!("user32.dll" "system" fn CopyIcon(hicon : HICON) -> HICON); let result__ = CopyIcon(hicon.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CopyImage(h: P0, r#type: GDI_IMAGE_TYPE, cx: i32, cy: i32, flags: IMAGE_FLAGS) -> windows_core::Result @@ -361,19 +361,19 @@ where { windows_targets::link!("user32.dll" "system" fn CopyImage(h : super::super::Foundation:: HANDLE, r#type : GDI_IMAGE_TYPE, cx : i32, cy : i32, flags : IMAGE_FLAGS) -> super::super::Foundation:: HANDLE); let result__ = CopyImage(h.param().abi(), r#type, cx, cy, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateAcceleratorTableA(paccel: &[ACCEL]) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn CreateAcceleratorTableA(paccel : *const ACCEL, caccel : i32) -> HACCEL); let result__ = CreateAcceleratorTableA(core::mem::transmute(paccel.as_ptr()), paccel.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateAcceleratorTableW(paccel: &[ACCEL]) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn CreateAcceleratorTableW(paccel : *const ACCEL, caccel : i32) -> HACCEL); let result__ = CreateAcceleratorTableW(core::mem::transmute(paccel.as_ptr()), paccel.len().try_into().unwrap()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Graphics_Gdi")] #[inline] @@ -392,7 +392,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateCursor(hinst : super::super::Foundation:: HINSTANCE, xhotspot : i32, yhotspot : i32, nwidth : i32, nheight : i32, pvandplane : *const core::ffi::c_void, pvxorplane : *const core::ffi::c_void) -> HCURSOR); let result__ = CreateCursor(hinst.param().abi(), xhotspot, yhotspot, nwidth, nheight, pvandplane, pvxorplane); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateDialogIndirectParamA(hinstance: P0, lptemplate: *const DLGTEMPLATE, hwndparent: P1, lpdialogfunc: DLGPROC, dwinitparam: P2) -> windows_core::Result @@ -403,7 +403,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDialogIndirectParamA(hinstance : super::super::Foundation:: HINSTANCE, lptemplate : *const DLGTEMPLATE, hwndparent : super::super::Foundation:: HWND, lpdialogfunc : DLGPROC, dwinitparam : super::super::Foundation:: LPARAM) -> super::super::Foundation:: HWND); let result__ = CreateDialogIndirectParamA(hinstance.param().abi(), lptemplate, hwndparent.param().abi(), lpdialogfunc, dwinitparam.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateDialogIndirectParamW(hinstance: P0, lptemplate: *const DLGTEMPLATE, hwndparent: P1, lpdialogfunc: DLGPROC, dwinitparam: P2) -> windows_core::Result @@ -414,7 +414,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDialogIndirectParamW(hinstance : super::super::Foundation:: HINSTANCE, lptemplate : *const DLGTEMPLATE, hwndparent : super::super::Foundation:: HWND, lpdialogfunc : DLGPROC, dwinitparam : super::super::Foundation:: LPARAM) -> super::super::Foundation:: HWND); let result__ = CreateDialogIndirectParamW(hinstance.param().abi(), lptemplate, hwndparent.param().abi(), lpdialogfunc, dwinitparam.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateDialogParamA(hinstance: P0, lptemplatename: P1, hwndparent: P2, lpdialogfunc: DLGPROC, dwinitparam: P3) -> windows_core::Result @@ -426,7 +426,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDialogParamA(hinstance : super::super::Foundation:: HINSTANCE, lptemplatename : windows_core::PCSTR, hwndparent : super::super::Foundation:: HWND, lpdialogfunc : DLGPROC, dwinitparam : super::super::Foundation:: LPARAM) -> super::super::Foundation:: HWND); let result__ = CreateDialogParamA(hinstance.param().abi(), lptemplatename.param().abi(), hwndparent.param().abi(), lpdialogfunc, dwinitparam.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateDialogParamW(hinstance: P0, lptemplatename: P1, hwndparent: P2, lpdialogfunc: DLGPROC, dwinitparam: P3) -> windows_core::Result @@ -438,7 +438,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateDialogParamW(hinstance : super::super::Foundation:: HINSTANCE, lptemplatename : windows_core::PCWSTR, hwndparent : super::super::Foundation:: HWND, lpdialogfunc : DLGPROC, dwinitparam : super::super::Foundation:: LPARAM) -> super::super::Foundation:: HWND); let result__ = CreateDialogParamW(hinstance.param().abi(), lptemplatename.param().abi(), hwndparent.param().abi(), lpdialogfunc, dwinitparam.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateIcon(hinstance: P0, nwidth: i32, nheight: i32, cplanes: u8, cbitspixel: u8, lpbandbits: *const u8, lpbxorbits: *const u8) -> windows_core::Result @@ -447,7 +447,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateIcon(hinstance : super::super::Foundation:: HINSTANCE, nwidth : i32, nheight : i32, cplanes : u8, cbitspixel : u8, lpbandbits : *const u8, lpbxorbits : *const u8) -> HICON); let result__ = CreateIcon(hinstance.param().abi(), nwidth, nheight, cplanes, cbitspixel, lpbandbits, lpbxorbits); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateIconFromResource(presbits: &[u8], ficon: P0, dwver: u32) -> windows_core::Result @@ -456,7 +456,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateIconFromResource(presbits : *const u8, dwressize : u32, ficon : super::super::Foundation:: BOOL, dwver : u32) -> HICON); let result__ = CreateIconFromResource(core::mem::transmute(presbits.as_ptr()), presbits.len().try_into().unwrap(), ficon.param().abi(), dwver); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateIconFromResourceEx(presbits: &[u8], ficon: P0, dwver: u32, cxdesired: i32, cydesired: i32, flags: IMAGE_FLAGS) -> windows_core::Result @@ -465,14 +465,14 @@ where { windows_targets::link!("user32.dll" "system" fn CreateIconFromResourceEx(presbits : *const u8, dwressize : u32, ficon : super::super::Foundation:: BOOL, dwver : u32, cxdesired : i32, cydesired : i32, flags : IMAGE_FLAGS) -> HICON); let result__ = CreateIconFromResourceEx(core::mem::transmute(presbits.as_ptr()), presbits.len().try_into().unwrap(), ficon.param().abi(), dwver, cxdesired, cydesired, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[cfg(feature = "Win32_Graphics_Gdi")] #[inline] pub unsafe fn CreateIconIndirect(piconinfo: *const ICONINFO) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn CreateIconIndirect(piconinfo : *const ICONINFO) -> HICON); let result__ = CreateIconIndirect(piconinfo); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateMDIWindowA(lpclassname: P0, lpwindowname: P1, dwstyle: WINDOW_STYLE, x: i32, y: i32, nwidth: i32, nheight: i32, hwndparent: P2, hinstance: P3, lparam: P4) -> windows_core::Result @@ -485,7 +485,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateMDIWindowA(lpclassname : windows_core::PCSTR, lpwindowname : windows_core::PCSTR, dwstyle : WINDOW_STYLE, x : i32, y : i32, nwidth : i32, nheight : i32, hwndparent : super::super::Foundation:: HWND, hinstance : super::super::Foundation:: HINSTANCE, lparam : super::super::Foundation:: LPARAM) -> super::super::Foundation:: HWND); let result__ = CreateMDIWindowA(lpclassname.param().abi(), lpwindowname.param().abi(), dwstyle, x, y, nwidth, nheight, hwndparent.param().abi(), hinstance.param().abi(), lparam.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateMDIWindowW(lpclassname: P0, lpwindowname: P1, dwstyle: WINDOW_STYLE, x: i32, y: i32, nwidth: i32, nheight: i32, hwndparent: P2, hinstance: P3, lparam: P4) -> windows_core::Result @@ -498,19 +498,19 @@ where { windows_targets::link!("user32.dll" "system" fn CreateMDIWindowW(lpclassname : windows_core::PCWSTR, lpwindowname : windows_core::PCWSTR, dwstyle : WINDOW_STYLE, x : i32, y : i32, nwidth : i32, nheight : i32, hwndparent : super::super::Foundation:: HWND, hinstance : super::super::Foundation:: HINSTANCE, lparam : super::super::Foundation:: LPARAM) -> super::super::Foundation:: HWND); let result__ = CreateMDIWindowW(lpclassname.param().abi(), lpwindowname.param().abi(), dwstyle, x, y, nwidth, nheight, hwndparent.param().abi(), hinstance.param().abi(), lparam.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateMenu() -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn CreateMenu() -> HMENU); let result__ = CreateMenu(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreatePopupMenu() -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn CreatePopupMenu() -> HMENU); let result__ = CreatePopupMenu(); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateResourceIndexer(projectroot: P0, extensiondllpath: P1, ppresourceindexer: *mut *mut core::ffi::c_void) -> windows_core::Result<()> @@ -532,7 +532,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateWindowExA(dwexstyle : WINDOW_EX_STYLE, lpclassname : windows_core::PCSTR, lpwindowname : windows_core::PCSTR, dwstyle : WINDOW_STYLE, x : i32, y : i32, nwidth : i32, nheight : i32, hwndparent : super::super::Foundation:: HWND, hmenu : HMENU, hinstance : super::super::Foundation:: HINSTANCE, lpparam : *const core::ffi::c_void) -> super::super::Foundation:: HWND); let result__ = CreateWindowExA(dwexstyle, lpclassname.param().abi(), lpwindowname.param().abi(), dwstyle, x, y, nwidth, nheight, hwndparent.param().abi(), hmenu.param().abi(), hinstance.param().abi(), core::mem::transmute(lpparam.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn CreateWindowExW(dwexstyle: WINDOW_EX_STYLE, lpclassname: P0, lpwindowname: P1, dwstyle: WINDOW_STYLE, x: i32, y: i32, nwidth: i32, nheight: i32, hwndparent: P2, hmenu: P3, hinstance: P4, lpparam: Option<*const core::ffi::c_void>) -> windows_core::Result @@ -545,7 +545,7 @@ where { windows_targets::link!("user32.dll" "system" fn CreateWindowExW(dwexstyle : WINDOW_EX_STYLE, lpclassname : windows_core::PCWSTR, lpwindowname : windows_core::PCWSTR, dwstyle : WINDOW_STYLE, x : i32, y : i32, nwidth : i32, nheight : i32, hwndparent : super::super::Foundation:: HWND, hmenu : HMENU, hinstance : super::super::Foundation:: HINSTANCE, lpparam : *const core::ffi::c_void) -> super::super::Foundation:: HWND); let result__ = CreateWindowExW(dwexstyle, lpclassname.param().abi(), lpwindowname.param().abi(), dwstyle, x, y, nwidth, nheight, hwndparent.param().abi(), hmenu.param().abi(), hinstance.param().abi(), core::mem::transmute(lpparam.unwrap_or(std::ptr::null()))); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DefDlgProcA(hdlg: P0, msg: u32, wparam: P1, lparam: P2) -> super::super::Foundation::LRESULT @@ -638,7 +638,7 @@ where { windows_targets::link!("user32.dll" "system" fn DeferWindowPos(hwinposinfo : HDWP, hwnd : super::super::Foundation:: HWND, hwndinsertafter : super::super::Foundation:: HWND, x : i32, y : i32, cx : i32, cy : i32, uflags : SET_WINDOW_POS_FLAGS) -> HDWP); let result__ = DeferWindowPos(hwinposinfo.param().abi(), hwnd.param().abi(), hwndinsertafter.param().abi(), x, y, cx, cy, uflags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn DeleteMenu(hmenu: P0, uposition: u32, uflags: MENU_ITEM_FLAGS) -> windows_core::Result<()> @@ -906,7 +906,7 @@ where { windows_targets::link!("user32.dll" "system" fn FindWindowA(lpclassname : windows_core::PCSTR, lpwindowname : windows_core::PCSTR) -> super::super::Foundation:: HWND); let result__ = FindWindowA(lpclassname.param().abi(), lpwindowname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindWindowExA(hwndparent: P0, hwndchildafter: P1, lpszclass: P2, lpszwindow: P3) -> windows_core::Result @@ -918,7 +918,7 @@ where { windows_targets::link!("user32.dll" "system" fn FindWindowExA(hwndparent : super::super::Foundation:: HWND, hwndchildafter : super::super::Foundation:: HWND, lpszclass : windows_core::PCSTR, lpszwindow : windows_core::PCSTR) -> super::super::Foundation:: HWND); let result__ = FindWindowExA(hwndparent.param().abi(), hwndchildafter.param().abi(), lpszclass.param().abi(), lpszwindow.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindWindowExW(hwndparent: P0, hwndchildafter: P1, lpszclass: P2, lpszwindow: P3) -> windows_core::Result @@ -930,7 +930,7 @@ where { windows_targets::link!("user32.dll" "system" fn FindWindowExW(hwndparent : super::super::Foundation:: HWND, hwndchildafter : super::super::Foundation:: HWND, lpszclass : windows_core::PCWSTR, lpszwindow : windows_core::PCWSTR) -> super::super::Foundation:: HWND); let result__ = FindWindowExW(hwndparent.param().abi(), hwndchildafter.param().abi(), lpszclass.param().abi(), lpszwindow.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FindWindowW(lpclassname: P0, lpwindowname: P1) -> windows_core::Result @@ -940,7 +940,7 @@ where { windows_targets::link!("user32.dll" "system" fn FindWindowW(lpclassname : windows_core::PCWSTR, lpwindowname : windows_core::PCWSTR) -> super::super::Foundation:: HWND); let result__ = FindWindowW(lpclassname.param().abi(), lpwindowname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn FlashWindow(hwnd: P0, binvert: P1) -> super::super::Foundation::BOOL @@ -1141,7 +1141,7 @@ where { windows_targets::link!("user32.dll" "system" fn GetDlgItem(hdlg : super::super::Foundation:: HWND, niddlgitem : i32) -> super::super::Foundation:: HWND); let result__ = GetDlgItem(hdlg.param().abi(), niddlgitem); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetDlgItemInt(hdlg: P0, niddlgitem: i32, lptranslated: Option<*mut super::super::Foundation::BOOL>, bsigned: P1) -> u32 @@ -1373,7 +1373,7 @@ where { windows_targets::link!("user32.dll" "system" fn GetNextDlgGroupItem(hdlg : super::super::Foundation:: HWND, hctl : super::super::Foundation:: HWND, bprevious : super::super::Foundation:: BOOL) -> super::super::Foundation:: HWND); let result__ = GetNextDlgGroupItem(hdlg.param().abi(), hctl.param().abi(), bprevious.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetNextDlgTabItem(hdlg: P0, hctl: P1, bprevious: P2) -> windows_core::Result @@ -1384,7 +1384,7 @@ where { windows_targets::link!("user32.dll" "system" fn GetNextDlgTabItem(hdlg : super::super::Foundation:: HWND, hctl : super::super::Foundation:: HWND, bprevious : super::super::Foundation:: BOOL) -> super::super::Foundation:: HWND); let result__ = GetNextDlgTabItem(hdlg.param().abi(), hctl.param().abi(), bprevious.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetParent(hwnd: P0) -> windows_core::Result @@ -1393,7 +1393,7 @@ where { windows_targets::link!("user32.dll" "system" fn GetParent(hwnd : super::super::Foundation:: HWND) -> super::super::Foundation:: HWND); let result__ = GetParent(hwnd.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetPhysicalCursorPos(lppoint: *mut super::super::Foundation::POINT) -> windows_core::Result<()> { @@ -1502,7 +1502,7 @@ where { windows_targets::link!("user32.dll" "system" fn GetTopWindow(hwnd : super::super::Foundation:: HWND) -> super::super::Foundation:: HWND); let result__ = GetTopWindow(hwnd.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetWindow(hwnd: P0, ucmd: GET_WINDOW_CMD) -> windows_core::Result @@ -1511,7 +1511,7 @@ where { windows_targets::link!("user32.dll" "system" fn GetWindow(hwnd : super::super::Foundation:: HWND, ucmd : GET_WINDOW_CMD) -> super::super::Foundation:: HWND); let result__ = GetWindow(hwnd.param().abi(), ucmd); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn GetWindowDisplayAffinity(hwnd: P0, pdwaffinity: *mut u32) -> windows_core::Result<()> @@ -1891,7 +1891,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadAcceleratorsA(hinstance : super::super::Foundation:: HINSTANCE, lptablename : windows_core::PCSTR) -> HACCEL); let result__ = LoadAcceleratorsA(hinstance.param().abi(), lptablename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadAcceleratorsW(hinstance: P0, lptablename: P1) -> windows_core::Result @@ -1901,7 +1901,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadAcceleratorsW(hinstance : super::super::Foundation:: HINSTANCE, lptablename : windows_core::PCWSTR) -> HACCEL); let result__ = LoadAcceleratorsW(hinstance.param().abi(), lptablename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadCursorA(hinstance: P0, lpcursorname: P1) -> windows_core::Result @@ -1911,7 +1911,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadCursorA(hinstance : super::super::Foundation:: HINSTANCE, lpcursorname : windows_core::PCSTR) -> HCURSOR); let result__ = LoadCursorA(hinstance.param().abi(), lpcursorname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadCursorFromFileA(lpfilename: P0) -> windows_core::Result @@ -1920,7 +1920,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadCursorFromFileA(lpfilename : windows_core::PCSTR) -> HCURSOR); let result__ = LoadCursorFromFileA(lpfilename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadCursorFromFileW(lpfilename: P0) -> windows_core::Result @@ -1929,7 +1929,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadCursorFromFileW(lpfilename : windows_core::PCWSTR) -> HCURSOR); let result__ = LoadCursorFromFileW(lpfilename.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadCursorW(hinstance: P0, lpcursorname: P1) -> windows_core::Result @@ -1939,7 +1939,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadCursorW(hinstance : super::super::Foundation:: HINSTANCE, lpcursorname : windows_core::PCWSTR) -> HCURSOR); let result__ = LoadCursorW(hinstance.param().abi(), lpcursorname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadIconA(hinstance: P0, lpiconname: P1) -> windows_core::Result @@ -1949,7 +1949,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadIconA(hinstance : super::super::Foundation:: HINSTANCE, lpiconname : windows_core::PCSTR) -> HICON); let result__ = LoadIconA(hinstance.param().abi(), lpiconname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadIconW(hinstance: P0, lpiconname: P1) -> windows_core::Result @@ -1959,7 +1959,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadIconW(hinstance : super::super::Foundation:: HINSTANCE, lpiconname : windows_core::PCWSTR) -> HICON); let result__ = LoadIconW(hinstance.param().abi(), lpiconname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadImageA(hinst: P0, name: P1, r#type: GDI_IMAGE_TYPE, cx: i32, cy: i32, fuload: IMAGE_FLAGS) -> windows_core::Result @@ -1969,7 +1969,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadImageA(hinst : super::super::Foundation:: HINSTANCE, name : windows_core::PCSTR, r#type : GDI_IMAGE_TYPE, cx : i32, cy : i32, fuload : IMAGE_FLAGS) -> super::super::Foundation:: HANDLE); let result__ = LoadImageA(hinst.param().abi(), name.param().abi(), r#type, cx, cy, fuload); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadImageW(hinst: P0, name: P1, r#type: GDI_IMAGE_TYPE, cx: i32, cy: i32, fuload: IMAGE_FLAGS) -> windows_core::Result @@ -1979,7 +1979,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadImageW(hinst : super::super::Foundation:: HINSTANCE, name : windows_core::PCWSTR, r#type : GDI_IMAGE_TYPE, cx : i32, cy : i32, fuload : IMAGE_FLAGS) -> super::super::Foundation:: HANDLE); let result__ = LoadImageW(hinst.param().abi(), name.param().abi(), r#type, cx, cy, fuload); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadMenuA(hinstance: P0, lpmenuname: P1) -> windows_core::Result @@ -1989,19 +1989,19 @@ where { windows_targets::link!("user32.dll" "system" fn LoadMenuA(hinstance : super::super::Foundation:: HINSTANCE, lpmenuname : windows_core::PCSTR) -> HMENU); let result__ = LoadMenuA(hinstance.param().abi(), lpmenuname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadMenuIndirectA(lpmenutemplate: *const core::ffi::c_void) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn LoadMenuIndirectA(lpmenutemplate : *const core::ffi::c_void) -> HMENU); let result__ = LoadMenuIndirectA(lpmenutemplate); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadMenuIndirectW(lpmenutemplate: *const core::ffi::c_void) -> windows_core::Result { windows_targets::link!("user32.dll" "system" fn LoadMenuIndirectW(lpmenutemplate : *const core::ffi::c_void) -> HMENU); let result__ = LoadMenuIndirectW(lpmenutemplate); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadMenuW(hinstance: P0, lpmenuname: P1) -> windows_core::Result @@ -2011,7 +2011,7 @@ where { windows_targets::link!("user32.dll" "system" fn LoadMenuW(hinstance : super::super::Foundation:: HINSTANCE, lpmenuname : windows_core::PCWSTR) -> HMENU); let result__ = LoadMenuW(hinstance.param().abi(), lpmenuname.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn LoadStringA(hinstance: P0, uid: u32, lpbuffer: windows_core::PSTR, cchbuffermax: i32) -> i32 @@ -2528,7 +2528,7 @@ where { windows_targets::link!("user32.dll" "system" fn RegisterDeviceNotificationA(hrecipient : super::super::Foundation:: HANDLE, notificationfilter : *const core::ffi::c_void, flags : REGISTER_NOTIFICATION_FLAGS) -> HDEVNOTIFY); let result__ = RegisterDeviceNotificationA(hrecipient.param().abi(), notificationfilter, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RegisterDeviceNotificationW(hrecipient: P0, notificationfilter: *const core::ffi::c_void, flags: REGISTER_NOTIFICATION_FLAGS) -> windows_core::Result @@ -2537,7 +2537,7 @@ where { windows_targets::link!("user32.dll" "system" fn RegisterDeviceNotificationW(hrecipient : super::super::Foundation:: HANDLE, notificationfilter : *const core::ffi::c_void, flags : REGISTER_NOTIFICATION_FLAGS) -> HDEVNOTIFY); let result__ = RegisterDeviceNotificationW(hrecipient.param().abi(), notificationfilter, flags); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RegisterForTooltipDismissNotification(hwnd: P0, tdflags: TOOLTIP_DISMISS_FLAGS) -> super::super::Foundation::BOOL @@ -2587,7 +2587,7 @@ where { windows_targets::link!("user32.dll" "system" fn RemovePropA(hwnd : super::super::Foundation:: HWND, lpstring : windows_core::PCSTR) -> super::super::Foundation:: HANDLE); let result__ = RemovePropA(hwnd.param().abi(), lpstring.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn RemovePropW(hwnd: P0, lpstring: P1) -> windows_core::Result @@ -2597,7 +2597,7 @@ where { windows_targets::link!("user32.dll" "system" fn RemovePropW(hwnd : super::super::Foundation:: HWND, lpstring : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE); let result__ = RemovePropW(hwnd.param().abi(), lpstring.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn ReplyMessage(lresult: P0) -> super::super::Foundation::BOOL @@ -2943,7 +2943,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetParent(hwndchild : super::super::Foundation:: HWND, hwndnewparent : super::super::Foundation:: HWND) -> super::super::Foundation:: HWND); let result__ = SetParent(hwndchild.param().abi(), hwndnewparent.param().abi()); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetPhysicalCursorPos(x: i32, y: i32) -> windows_core::Result<()> { @@ -3093,7 +3093,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetWindowsHookExA(idhook : WINDOWS_HOOK_ID, lpfn : HOOKPROC, hmod : super::super::Foundation:: HINSTANCE, dwthreadid : u32) -> HHOOK); let result__ = SetWindowsHookExA(idhook, lpfn, hmod.param().abi(), dwthreadid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetWindowsHookExW(idhook: WINDOWS_HOOK_ID, lpfn: HOOKPROC, hmod: P0, dwthreadid: u32) -> windows_core::Result @@ -3102,7 +3102,7 @@ where { windows_targets::link!("user32.dll" "system" fn SetWindowsHookExW(idhook : WINDOWS_HOOK_ID, lpfn : HOOKPROC, hmod : super::super::Foundation:: HINSTANCE, dwthreadid : u32) -> HHOOK); let result__ = SetWindowsHookExW(idhook, lpfn, hmod.param().abi(), dwthreadid); - (!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32) + (!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32) } #[inline] pub unsafe fn SetWindowsHookW(nfiltertype: i32, pfnfilterproc: HOOKPROC) -> HHOOK {