@@ -46,12 +46,10 @@ pub fn expand(input: &syn::DeriveInput, _: &str) -> syn::Result<TokenStream> {
46
46
47
47
Ok ( quote ! {
48
48
#[ automatically_derived]
49
- impl #impl_gens :: core:: fmt:: Debug for #ident #ty_gens
50
- #where_clause
51
- {
49
+ impl #impl_gens :: derive_more:: Debug for #ident #ty_gens #where_clause {
52
50
fn fmt(
53
- & self , __derive_more_f: & mut :: core:: fmt:: Formatter <' _>
54
- ) -> :: core:: fmt:: Result {
51
+ & self , __derive_more_f: & mut :: derive_more :: core:: fmt:: Formatter <' _>
52
+ ) -> :: derive_more :: core:: fmt:: Result {
55
53
#body
56
54
}
57
55
}
@@ -229,17 +227,17 @@ impl<'a> Expansion<'a> {
229
227
fn generate_body ( & self ) -> syn:: Result < TokenStream > {
230
228
if let Some ( fmt) = & self . attr . fmt {
231
229
return Ok ( if let Some ( ( expr, trait_ident) ) = fmt. transparent_call ( ) {
232
- quote ! { :: core:: fmt:: #trait_ident:: fmt( & ( #expr) , __derive_more_f) }
230
+ quote ! { :: derive_more :: core:: fmt:: #trait_ident:: fmt( & ( #expr) , __derive_more_f) }
233
231
} else {
234
- quote ! { :: core:: write!( __derive_more_f, #fmt) }
232
+ quote ! { :: derive_more :: core:: write!( __derive_more_f, #fmt) }
235
233
} ) ;
236
234
} ;
237
235
238
236
match self . fields {
239
237
syn:: Fields :: Unit => {
240
238
let ident = self . ident . to_string ( ) ;
241
239
Ok ( quote ! {
242
- :: core:: fmt:: Formatter :: write_str(
240
+ :: derive_more :: core:: fmt:: Formatter :: write_str(
243
241
__derive_more_f,
244
242
#ident,
245
243
)
@@ -268,7 +266,7 @@ impl<'a> Expansion<'a> {
268
266
Some ( FieldAttribute :: Right ( fmt_attr) ) => Ok ( quote ! {
269
267
:: derive_more:: __private:: DebugTuple :: field(
270
268
#out,
271
- & :: core:: format_args!( #fmt_attr) ,
269
+ & :: derive_more :: core:: format_args!( #fmt_attr) ,
272
270
)
273
271
} ) ,
274
272
None => {
@@ -291,7 +289,7 @@ impl<'a> Expansion<'a> {
291
289
let ident = self . ident . to_string ( ) ;
292
290
293
291
let out = quote ! {
294
- & mut :: core:: fmt:: Formatter :: debug_struct(
292
+ & mut :: derive_more :: core:: fmt:: Formatter :: debug_struct(
295
293
__derive_more_f,
296
294
#ident,
297
295
)
@@ -309,21 +307,21 @@ impl<'a> Expansion<'a> {
309
307
Ok :: < _ , syn:: Error > ( out)
310
308
}
311
309
Some ( FieldAttribute :: Right ( fmt_attr) ) => Ok ( quote ! {
312
- :: core:: fmt:: DebugStruct :: field(
310
+ :: derive_more :: core:: fmt:: DebugStruct :: field(
313
311
#out,
314
312
#field_str,
315
- & :: core:: format_args!( #fmt_attr) ,
313
+ & :: derive_more :: core:: format_args!( #fmt_attr) ,
316
314
)
317
315
} ) ,
318
316
None => Ok ( quote ! {
319
- :: core:: fmt:: DebugStruct :: field( #out, #field_str, #field_ident)
317
+ :: derive_more :: core:: fmt:: DebugStruct :: field( #out, #field_str, #field_ident)
320
318
} ) ,
321
319
}
322
320
} ) ?;
323
321
Ok ( if exhaustive {
324
- quote ! { :: core:: fmt:: DebugStruct :: finish( #out) }
322
+ quote ! { :: derive_more :: core:: fmt:: DebugStruct :: finish( #out) }
325
323
} else {
326
- quote ! { :: core:: fmt:: DebugStruct :: finish_non_exhaustive( #out) }
324
+ quote ! { :: derive_more :: core:: fmt:: DebugStruct :: finish_non_exhaustive( #out) }
327
325
} )
328
326
}
329
327
}
@@ -337,7 +335,7 @@ impl<'a> Expansion<'a> {
337
335
out. extend ( fmt. bounded_types ( self . fields ) . map ( |( ty, trait_name) | {
338
336
let trait_ident = format_ident ! ( "{trait_name}" ) ;
339
337
340
- parse_quote ! { #ty: :: core:: fmt:: #trait_ident }
338
+ parse_quote ! { #ty: :: derive_more :: core:: fmt:: #trait_ident }
341
339
} ) ) ;
342
340
Ok ( out)
343
341
} else {
@@ -351,12 +349,12 @@ impl<'a> Expansion<'a> {
351
349
|( ty, trait_name) | {
352
350
let trait_ident = format_ident ! ( "{trait_name}" ) ;
353
351
354
- parse_quote ! { #ty: :: core:: fmt:: #trait_ident }
352
+ parse_quote ! { #ty: :: derive_more :: core:: fmt:: #trait_ident }
355
353
} ,
356
354
) ) ;
357
355
}
358
356
Some ( FieldAttribute :: Left ( _skip) ) => { }
359
- None => out. extend ( [ parse_quote ! { #ty: :: core :: fmt :: Debug } ] ) ,
357
+ None => out. extend ( [ parse_quote ! { #ty: :: derive_more :: Debug } ] ) ,
360
358
}
361
359
Ok ( out)
362
360
} )
0 commit comments