Skip to content

Commit

Permalink
Merge pull request #45 from bugadani/core
Browse files Browse the repository at this point in the history
Reference _the_ core module
  • Loading branch information
Manishearth authored Jun 20, 2024
2 parents 899662c + 638f5b0 commit 8416762
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit 8416762

Please sign in to comment.