Skip to content

Commit

Permalink
Remove unnecessary std usage from bindgen in writer.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajw221 committed Dec 26, 2023
1 parent 0a65f6c commit b0c4c52
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 81 deletions.
18 changes: 9 additions & 9 deletions crates/libs/bindgen/src/rust/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ impl Writer {
quote! { *mut ::core::ffi::c_void }
}
metadata::Type::String => {
quote! { ::std::mem::MaybeUninit<::windows_core::HSTRING> }
quote! { ::core::mem::MaybeUninit<::windows_core::HSTRING> }
}
metadata::Type::BSTR => {
quote! { ::std::mem::MaybeUninit<::windows_core::BSTR> }
quote! { ::core::mem::MaybeUninit<::windows_core::BSTR> }
}
metadata::Type::Win32Array(kind, len) => {
let name = self.type_abi_name(kind);
Expand All @@ -214,7 +214,7 @@ impl Writer {
if metadata::type_def_is_blittable(*def) {
tokens
} else {
quote! { ::std::mem::MaybeUninit<#tokens> }
quote! { ::core::mem::MaybeUninit<#tokens> }
}
}
metadata::TypeKind::Delegate => {
Expand Down Expand Up @@ -616,10 +616,10 @@ impl Writer {
}
}
#features
impl<#constraints> ::std::future::Future for #ident {
impl<#constraints> ::core::future::Future for #ident {
type Output = ::windows_core::Result<#return_type>;

fn poll(self: ::std::pin::Pin<&mut Self>, context: &mut ::std::task::Context<'_>) -> ::std::task::Poll<Self::Output> {
fn poll(self: ::core::pin::Pin<&mut Self>, context: &mut ::core::task::Context<'_>) -> ::core::task::Poll<Self::Output> {
if self.Status()? == #namespace AsyncStatus::Started {
let waker = context.waker().clone();

Expand All @@ -628,9 +628,9 @@ impl Writer {
Ok(())
}));

::std::task::Poll::Pending
::core::task::Poll::Pending
} else {
::std::task::Poll::Ready(self.GetResults())
::core::task::Poll::Ready(self.GetResults())
}
}
}
Expand Down Expand Up @@ -931,9 +931,9 @@ impl Writer {
}
metadata::SignatureParamKind::OptionalPointer => {
if flags.contains(metadata::ParamAttributes::Out) {
quote! { ::core::mem::transmute(#name.unwrap_or(::std::ptr::null_mut())), }
quote! { ::core::mem::transmute(#name.unwrap_or(::core::ptr::null_mut())), }
} else {
quote! { ::core::mem::transmute(#name.unwrap_or(::std::ptr::null())), }
quote! { ::core::mem::transmute(#name.unwrap_or(::core::ptr::null())), }
}
}
metadata::SignatureParamKind::ValueType => {
Expand Down
86 changes: 43 additions & 43 deletions crates/tests/standalone/src/b_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1382,27 +1382,27 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub NumeralSystem: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub SetNumeralSystem: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
value: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
value: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub GetCalendarSystem: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub ChangeCalendarSystem: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
value: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
value: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub GetClock: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub ChangeClock: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
value: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
value: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub GetDateTime: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1440,12 +1440,12 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub EraAsFullString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub EraAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub FirstYearInThisEra: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1473,17 +1473,17 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub YearAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub YearAsTruncatedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
remainingdigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub YearAsPaddedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub FirstMonthInThisYear: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1511,30 +1511,30 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub MonthAsFullString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub MonthAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub MonthAsFullSoloString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub MonthAsSoloString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub MonthAsNumericString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub MonthAsPaddedNumericString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub AddWeeks: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1566,34 +1566,34 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub DayAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub DayAsPaddedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub DayOfWeek: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut DayOfWeek,
) -> ::windows_core::HRESULT,
pub DayOfWeekAsFullString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub DayOfWeekAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub DayOfWeekAsFullSoloString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub DayOfWeekAsSoloString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub FirstPeriodInThisDay: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1621,12 +1621,12 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub PeriodAsFullString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub PeriodAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub FirstHourInThisPeriod: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1654,12 +1654,12 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub HourAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub HourAsPaddedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub Minute: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand All @@ -1675,12 +1675,12 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub MinuteAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub MinuteAsPaddedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub Second: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand All @@ -1696,12 +1696,12 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub SecondAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub SecondAsPaddedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub Nanosecond: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand All @@ -1717,12 +1717,12 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub NanosecondAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub NanosecondAsPaddedString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
mindigits: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub Compare: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1764,7 +1764,7 @@ pub struct ICalendar_Vtbl {
) -> ::windows_core::HRESULT,
pub ResolvedLanguage: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub IsDaylightSavingTime: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
Expand Down Expand Up @@ -1795,8 +1795,8 @@ pub struct ICalendarFactory_Vtbl {
pub CreateCalendar: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
languages: *mut ::core::ffi::c_void,
calendar: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
clock: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
calendar: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
clock: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut *mut ::core::ffi::c_void,
) -> ::windows_core::HRESULT,
}
Expand All @@ -1818,9 +1818,9 @@ pub struct ICalendarFactory2_Vtbl {
pub CreateCalendarWithTimeZone: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
languages: *mut ::core::ffi::c_void,
calendar: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
clock: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
timezoneid: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
calendar: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
clock: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
timezoneid: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut *mut ::core::ffi::c_void,
) -> ::windows_core::HRESULT,
}
Expand Down Expand Up @@ -2033,20 +2033,20 @@ pub struct ITimeZoneOnCalendar_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub GetTimeZone: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub ChangeTimeZone: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
timezoneid: ::std::mem::MaybeUninit<::windows_core::HSTRING>,
timezoneid: ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub TimeZoneAsFullString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
pub TimeZoneAsString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
ideallength: i32,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
}
#[repr(transparent)]
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/standalone/src/b_stringable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ pub struct IStringable_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub ToString: unsafe extern "system" fn(
this: *mut ::core::ffi::c_void,
result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>,
result__: *mut ::core::mem::MaybeUninit<::windows_core::HSTRING>,
) -> ::windows_core::HRESULT,
}
Loading

0 comments on commit b0c4c52

Please sign in to comment.