From 025a4bc41f049a394172020a5a623c9714d40151 Mon Sep 17 00:00:00 2001 From: Vincent Thiberville Date: Thu, 28 Nov 2024 13:55:27 +0100 Subject: [PATCH] fix: remove use of std in windows-strings h! macro This crate can be used in no_std, but some use of std were left in the h! macro. They can be trivially converted to core. --- crates/libs/strings/src/literals.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/libs/strings/src/literals.rs b/crates/libs/strings/src/literals.rs index 493ca14bd6..c5c5d86c97 100644 --- a/crates/libs/strings/src/literals.rs +++ b/crates/libs/strings/src/literals.rs @@ -44,7 +44,7 @@ macro_rules! h { #[allow(clippy::declare_interior_mutable_const)] const RESULT: $crate::HSTRING = { if OUTPUT_LEN == 1 { - unsafe { ::std::mem::transmute(::std::ptr::null::()) } + unsafe { ::core::mem::transmute(::core::ptr::null::()) } } else { const OUTPUT: $crate::PCWSTR = $crate::w!($s); const HEADER: $crate::HSTRING_HEADER = $crate::HSTRING_HEADER { @@ -56,7 +56,7 @@ macro_rules! h { }; // SAFETY: an `HSTRING` is exactly equivalent to a pointer to an `HSTRING_HEADER` unsafe { - ::std::mem::transmute::<&$crate::HSTRING_HEADER, $crate::HSTRING>(&HEADER) + ::core::mem::transmute::<&$crate::HSTRING_HEADER, $crate::HSTRING>(&HEADER) } } };