@@ -193,7 +193,7 @@ impl BakedExporter {
193
193
relative_path : P ,
194
194
data : TokenStream ,
195
195
) -> Result < ( ) , DataError > {
196
- let path = self . mod_directory . join ( & relative_path) . with_extension ( "rs" ) ;
196
+ let path = self . mod_directory . join ( & relative_path) ;
197
197
198
198
let mut formatted = if self . pretty {
199
199
use std:: process:: { Command , Stdio } ;
@@ -428,7 +428,7 @@ impl DataExporter for BakedExporter {
428
428
) ;
429
429
let prefixed_macro_ident = format ! ( "__impl_{ident}" ) . parse :: < TokenStream > ( ) . unwrap ( ) ;
430
430
self . write_to_file (
431
- PathBuf :: from ( format ! ( "macros/{}" , ident) ) ,
431
+ PathBuf :: from ( format ! ( "macros/{}.data.rs " , ident) ) ,
432
432
quote ! {
433
433
#[ doc = #doc]
434
434
/// hardcoded in this file. This allows the struct to be used with
@@ -514,6 +514,10 @@ impl DataExporter for BakedExporter {
514
514
. values ( )
515
515
. map ( |data| data. mod_ident . parse :: < TokenStream > ( ) . unwrap ( ) )
516
516
. collect :: < Vec < _ > > ( ) ;
517
+ let file_paths = data
518
+ . values ( )
519
+ . map ( |data| format ! ( "macros/{}.data.rs" , data. mod_ident) )
520
+ . collect :: < Vec < _ > > ( ) ;
517
521
518
522
// We prefix all macros with `__`, as these will be automatically exported at the crate root, which is annoying
519
523
// for crates that include the data but don't want it to be public. We then reexport them as items that use
@@ -558,18 +562,13 @@ impl DataExporter for BakedExporter {
558
562
} ;
559
563
560
564
self . write_to_file (
561
- PathBuf :: from ( "macros" ) ,
565
+ PathBuf :: from ( "macros.rs " ) ,
562
566
quote ! {
563
567
564
- #[ macro_use]
565
- mod macros {
566
- #(
567
- #[ macro_use]
568
- mod #mod_idents;
569
- ) *
570
- }
571
-
572
568
#(
569
+ #[ macro_use]
570
+ #[ path = #file_paths]
571
+ mod #mod_idents;
573
572
#[ doc( inline) ]
574
573
pub use #prefixed_macro_idents as #macro_idents;
575
574
) *
@@ -624,7 +623,7 @@ impl DataExporter for BakedExporter {
624
623
625
624
// For backwards compatibility
626
625
self . write_to_file (
627
- PathBuf :: from ( "mod" ) ,
626
+ PathBuf :: from ( "mod.rs " ) ,
628
627
quote ! {
629
628
include!( "macros.rs" ) ;
630
629
#[ clippy:: msrv = "1.61" ]
@@ -635,7 +634,7 @@ impl DataExporter for BakedExporter {
635
634
636
635
// For backwards compatibility
637
636
self . write_to_file (
638
- PathBuf :: from ( "any" ) ,
637
+ PathBuf :: from ( "any.rs " ) ,
639
638
quote ! {
640
639
// This assumes that `mod.rs` is already included.
641
640
impl_any_provider!( BakedDataProvider ) ;
0 commit comments