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

Perform imports from thiserror through absolute path #368

Merged
merged 1 commit into from
Nov 6, 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
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
Loading