@@ -45,14 +45,14 @@ fn impl_struct(input: Struct) -> TokenStream {
45
45
} ;
46
46
let dyn_error = quote_spanned ! ( source. span( ) => self . #source #asref. as_dyn_error( ) ) ;
47
47
Some ( quote ! {
48
- std :: option:: Option :: Some ( #dyn_error)
48
+ :: core :: option:: Option :: Some ( #dyn_error)
49
49
} )
50
50
} else {
51
51
None
52
52
} ;
53
53
let source_method = source_body. map ( |body| {
54
54
quote ! {
55
- fn source( & self ) -> std :: option:: Option <& ( dyn std:: error:: Error + ' static ) > {
55
+ fn source( & self ) -> :: core :: option:: Option <& ( dyn std:: error:: Error + ' static ) > {
56
56
use thiserror:: __private:: AsDynError ;
57
57
#body
58
58
}
@@ -66,7 +66,7 @@ fn impl_struct(input: Struct) -> TokenStream {
66
66
let source = & source_field. member ;
67
67
let source_provide = if type_is_option ( source_field. ty ) {
68
68
quote_spanned ! { source. span( ) =>
69
- if let std :: option:: Option :: Some ( source) = & self . #source {
69
+ if let :: core :: option:: Option :: Some ( source) = & self . #source {
70
70
source. thiserror_provide( #request) ;
71
71
}
72
72
}
@@ -79,7 +79,7 @@ fn impl_struct(input: Struct) -> TokenStream {
79
79
None
80
80
} else if type_is_option ( backtrace_field. ty ) {
81
81
Some ( quote ! {
82
- if let std :: option:: Option :: Some ( backtrace) = & self . #backtrace {
82
+ if let :: core :: option:: Option :: Some ( backtrace) = & self . #backtrace {
83
83
#request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
84
84
}
85
85
} )
@@ -95,7 +95,7 @@ fn impl_struct(input: Struct) -> TokenStream {
95
95
}
96
96
} else if type_is_option ( backtrace_field. ty ) {
97
97
quote ! {
98
- if let std :: option:: Option :: Some ( backtrace) = & self . #backtrace {
98
+ if let :: core :: option:: Option :: Some ( backtrace) = & self . #backtrace {
99
99
#request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
100
100
}
101
101
}
@@ -116,7 +116,7 @@ fn impl_struct(input: Struct) -> TokenStream {
116
116
let only_field = & input. fields [ 0 ] . member ;
117
117
display_implied_bounds. insert ( ( 0 , Trait :: Display ) ) ;
118
118
Some ( quote ! {
119
- std :: fmt:: Display :: fmt( & self . #only_field, __formatter)
119
+ :: core :: fmt:: Display :: fmt( & self . #only_field, __formatter)
120
120
} )
121
121
} else if let Some ( display) = & input. attrs . display {
122
122
display_implied_bounds = display. implied_bounds . clone ( ) ;
@@ -142,9 +142,9 @@ fn impl_struct(input: Struct) -> TokenStream {
142
142
let display_where_clause = display_inferred_bounds. augment_where_clause ( input. generics ) ;
143
143
quote ! {
144
144
#[ allow( unused_qualifications) ]
145
- impl #impl_generics std :: fmt:: Display for #ty #ty_generics #display_where_clause {
145
+ impl #impl_generics :: core :: fmt:: Display for #ty #ty_generics #display_where_clause {
146
146
#[ allow( clippy:: used_underscore_binding) ]
147
- fn fmt( & self , __formatter: & mut std :: fmt:: Formatter ) -> std :: fmt:: Result {
147
+ fn fmt( & self , __formatter: & mut :: core :: fmt:: Formatter ) -> :: core :: fmt:: Result {
148
148
#body
149
149
}
150
150
}
@@ -157,7 +157,7 @@ fn impl_struct(input: Struct) -> TokenStream {
157
157
let body = from_initializer ( from_field, backtrace_field) ;
158
158
quote ! {
159
159
#[ allow( unused_qualifications) ]
160
- impl #impl_generics std :: convert:: From <#from> for #ty #ty_generics #where_clause {
160
+ impl #impl_generics :: core :: convert:: From <#from> for #ty #ty_generics #where_clause {
161
161
#[ allow( deprecated) ]
162
162
fn from( source: #from) -> Self {
163
163
#ty #body
@@ -217,16 +217,16 @@ fn impl_enum(input: Enum) -> TokenStream {
217
217
let varsource = quote ! ( source) ;
218
218
let dyn_error = quote_spanned ! ( source. span( ) => #varsource #asref. as_dyn_error( ) ) ;
219
219
quote ! {
220
- #ty:: #ident { #source: #varsource, ..} => std :: option:: Option :: Some ( #dyn_error) ,
220
+ #ty:: #ident { #source: #varsource, ..} => :: core :: option:: Option :: Some ( #dyn_error) ,
221
221
}
222
222
} else {
223
223
quote ! {
224
- #ty:: #ident { ..} => std :: option:: Option :: None ,
224
+ #ty:: #ident { ..} => :: core :: option:: Option :: None ,
225
225
}
226
226
}
227
227
} ) ;
228
228
Some ( quote ! {
229
- fn source( & self ) -> std :: option:: Option <& ( dyn std:: error:: Error + ' static ) > {
229
+ fn source( & self ) -> :: core :: option:: Option <& ( dyn std:: error:: Error + ' static ) > {
230
230
use thiserror:: __private:: AsDynError ;
231
231
#[ allow( deprecated) ]
232
232
match self {
@@ -251,7 +251,7 @@ fn impl_enum(input: Enum) -> TokenStream {
251
251
let varsource = quote ! ( source) ;
252
252
let source_provide = if type_is_option ( source_field. ty ) {
253
253
quote_spanned ! { source. span( ) =>
254
- if let std :: option:: Option :: Some ( source) = #varsource {
254
+ if let :: core :: option:: Option :: Some ( source) = #varsource {
255
255
source. thiserror_provide( #request) ;
256
256
}
257
257
}
@@ -262,7 +262,7 @@ fn impl_enum(input: Enum) -> TokenStream {
262
262
} ;
263
263
let self_provide = if type_is_option ( backtrace_field. ty ) {
264
264
quote ! {
265
- if let std :: option:: Option :: Some ( backtrace) = backtrace {
265
+ if let :: core :: option:: Option :: Some ( backtrace) = backtrace {
266
266
#request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
267
267
}
268
268
}
@@ -290,7 +290,7 @@ fn impl_enum(input: Enum) -> TokenStream {
290
290
let varsource = quote ! ( source) ;
291
291
let source_provide = if type_is_option ( source_field. ty ) {
292
292
quote_spanned ! { backtrace. span( ) =>
293
- if let std :: option:: Option :: Some ( source) = #varsource {
293
+ if let :: core :: option:: Option :: Some ( source) = #varsource {
294
294
source. thiserror_provide( #request) ;
295
295
}
296
296
}
@@ -310,7 +310,7 @@ fn impl_enum(input: Enum) -> TokenStream {
310
310
let backtrace = & backtrace_field. member ;
311
311
let body = if type_is_option ( backtrace_field. ty ) {
312
312
quote ! {
313
- if let std :: option:: Option :: Some ( backtrace) = backtrace {
313
+ if let :: core :: option:: Option :: Some ( backtrace) = backtrace {
314
314
#request. provide_ref:: <std:: backtrace:: Backtrace >( backtrace) ;
315
315
}
316
316
}
@@ -369,7 +369,7 @@ fn impl_enum(input: Enum) -> TokenStream {
369
369
Member :: Unnamed ( index) => format_ident ! ( "_{}" , index) ,
370
370
} ;
371
371
display_implied_bounds. insert ( ( 0 , Trait :: Display ) ) ;
372
- quote ! ( std :: fmt:: Display :: fmt( #only_field, __formatter) )
372
+ quote ! ( :: core :: fmt:: Display :: fmt( #only_field, __formatter) )
373
373
}
374
374
} ;
375
375
for ( field, bound) in display_implied_bounds {
@@ -388,8 +388,8 @@ fn impl_enum(input: Enum) -> TokenStream {
388
388
let display_where_clause = display_inferred_bounds. augment_where_clause ( input. generics ) ;
389
389
Some ( quote ! {
390
390
#[ allow( unused_qualifications) ]
391
- impl #impl_generics std :: fmt:: Display for #ty #ty_generics #display_where_clause {
392
- fn fmt( & self , __formatter: & mut std :: fmt:: Formatter ) -> std :: fmt:: Result {
391
+ impl #impl_generics :: core :: fmt:: Display for #ty #ty_generics #display_where_clause {
392
+ fn fmt( & self , __formatter: & mut :: core :: fmt:: Formatter ) -> :: core :: fmt:: Result {
393
393
#use_as_display
394
394
#[ allow( unused_variables, deprecated, clippy:: used_underscore_binding) ]
395
395
match #void_deref self {
@@ -410,7 +410,7 @@ fn impl_enum(input: Enum) -> TokenStream {
410
410
let body = from_initializer ( from_field, backtrace_field) ;
411
411
Some ( quote ! {
412
412
#[ allow( unused_qualifications) ]
413
- impl #impl_generics std :: convert:: From <#from> for #ty #ty_generics #where_clause {
413
+ impl #impl_generics :: core :: convert:: From <#from> for #ty #ty_generics #where_clause {
414
414
#[ allow( deprecated) ]
415
415
fn from( source: #from) -> Self {
416
416
#ty:: #variant #body
@@ -466,19 +466,19 @@ fn use_as_display(needs_as_display: bool) -> Option<TokenStream> {
466
466
fn from_initializer ( from_field : & Field , backtrace_field : Option < & Field > ) -> TokenStream {
467
467
let from_member = & from_field. member ;
468
468
let some_source = if type_is_option ( from_field. ty ) {
469
- quote ! ( std :: option:: Option :: Some ( source) )
469
+ quote ! ( :: core :: option:: Option :: Some ( source) )
470
470
} else {
471
471
quote ! ( source)
472
472
} ;
473
473
let backtrace = backtrace_field. map ( |backtrace_field| {
474
474
let backtrace_member = & backtrace_field. member ;
475
475
if type_is_option ( backtrace_field. ty ) {
476
476
quote ! {
477
- #backtrace_member: std :: option:: Option :: Some ( std:: backtrace:: Backtrace :: capture( ) ) ,
477
+ #backtrace_member: :: core :: option:: Option :: Some ( :: std:: backtrace:: Backtrace :: capture( ) ) ,
478
478
}
479
479
} else {
480
480
quote ! {
481
- #backtrace_member: std :: convert:: From :: from( std:: backtrace:: Backtrace :: capture( ) ) ,
481
+ #backtrace_member: :: core :: convert:: From :: from( :: std:: backtrace:: Backtrace :: capture( ) ) ,
482
482
}
483
483
}
484
484
} ) ;
0 commit comments