Skip to content

Commit

Permalink
fix: remove use of std in windows-strings h! macro
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vthib committed Nov 28, 2024
1 parent d41381d commit 025a4bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/libs/strings/src/literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u16>()) }
unsafe { ::core::mem::transmute(::core::ptr::null::<u16>()) }
} else {
const OUTPUT: $crate::PCWSTR = $crate::w!($s);
const HEADER: $crate::HSTRING_HEADER = $crate::HSTRING_HEADER {
Expand All @@ -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)
}
}
};
Expand Down

0 comments on commit 025a4bc

Please sign in to comment.