Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference _the_ core module #45

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn specialization() -> TokenStream {
fn __displaydoc_display(&self) -> Self;
}

impl<T: core::fmt::Display> DisplayToDisplayDoc for &T {
impl<T: ::core::fmt::Display> DisplayToDisplayDoc for &T {
fn __displaydoc_display(&self) -> Self {
self
}
Expand Down Expand Up @@ -90,8 +90,8 @@ fn impl_struct(input: &DeriveInput, data: &DataStruct) -> Result<TokenStream> {
Fields::Unit => quote!(_),
};
quote! {
impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause {
fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
impl #impl_generics ::core::fmt::Display for #ty #ty_generics #where_clause {
fn fmt(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
// NB: This destructures the fields of `self` into named variables (for unnamed
// fields, it uses _0, _1, etc as above). The `#[allow(unused_variables)]`
// section means it doesn't have to parse the individual field references out of
Expand Down Expand Up @@ -365,8 +365,8 @@ fn impl_enum(input: &DeriveInput, data: &DataEnum) -> Result<TokenStream> {

if data.variants.is_empty() {
Ok(quote! {
impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause {
fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
impl #impl_generics ::core::fmt::Display for #ty #ty_generics #where_clause {
fn fmt(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
unreachable!("empty enums cannot be instantiated and thus cannot be printed")
}
}
Expand Down Expand Up @@ -394,8 +394,8 @@ fn impl_enum(input: &DeriveInput, data: &DataEnum) -> Result<TokenStream> {
})
.collect::<Result<Vec<_>>>()?;
Ok(quote! {
impl #impl_generics core::fmt::Display for #ty #ty_generics #where_clause {
fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
impl #impl_generics ::core::fmt::Display for #ty #ty_generics #where_clause {
fn fmt(&self, formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
#[allow(unused_variables)]
match self {
#(#arms,)*
Expand Down
Loading