Skip to content

Commit

Permalink
Perform imports from thiserror through absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 6, 2024
1 parent 184c100 commit fa2ba3a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions impl/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn impl_struct(input: Struct) -> TokenStream {
let source_method = source_body.map(|body| {
quote! {
fn source(&self) -> ::core::option::Option<&(dyn std::error::Error + 'static)> {
use thiserror::__private::AsDynError as _;
use ::thiserror::__private::AsDynError as _;
#body
}
}
Expand Down Expand Up @@ -127,7 +127,7 @@ fn impl_struct(input: Struct) -> TokenStream {
})
};
quote! {
use thiserror::__private::ThiserrorProvide as _;
use ::thiserror::__private::ThiserrorProvide as _;
#source_provide
#self_provide
}
Expand Down Expand Up @@ -273,7 +273,7 @@ fn impl_enum(input: Enum) -> TokenStream {
});
Some(quote! {
fn source(&self) -> ::core::option::Option<&(dyn std::error::Error + 'static)> {
use thiserror::__private::AsDynError as _;
use ::thiserror::__private::AsDynError as _;
#[allow(deprecated)]
match self {
#(#arms)*
Expand Down Expand Up @@ -323,7 +323,7 @@ fn impl_enum(input: Enum) -> TokenStream {
#source: #varsource,
..
} => {
use thiserror::__private::ThiserrorProvide as _;
use ::thiserror::__private::ThiserrorProvide as _;
#source_provide
#self_provide
}
Expand All @@ -347,7 +347,7 @@ fn impl_enum(input: Enum) -> TokenStream {
};
quote! {
#ty::#ident {#backtrace: #varsource, ..} => {
use thiserror::__private::ThiserrorProvide as _;
use ::thiserror::__private::ThiserrorProvide as _;
#source_provide
}
}
Expand Down Expand Up @@ -510,7 +510,7 @@ fn fields_pat(fields: &[Field]) -> TokenStream {
fn use_as_display(needs_as_display: bool) -> Option<TokenStream> {
if needs_as_display {
Some(quote! {
use thiserror::__private::AsDisplay as _;
use ::thiserror::__private::AsDisplay as _;
})
} else {
None
Expand Down

0 comments on commit fa2ba3a

Please sign in to comment.