Repository: dtolnay/cargo-expand (language: rust)

Issue:
Disable sorting of imports in rustfmt invocation
This can make the expanded code very hard to match up with the original code in cases where some macros expand into `use` items, such as in the case of #[proc_macro_hack].


Discussion / hints:

Fix patch:
diff --git a/src/fmt.rs b/src/fmt.rs
index fb42d46..7dda794 100644
--- a/src/fmt.rs
+++ b/src/fmt.rs
@@ -8,11 +8,15 @@ use crate::error::Result;
 #[derive(Serialize)]
 struct Rustfmt {
     normalize_doc_attributes: bool,
+    reorder_imports: bool,
+    reorder_modules: bool,
 }
 
 pub fn write_rustfmt_config(outdir: impl AsRef<Path>) -> Result<()> {
     let config = Rustfmt {
         normalize_doc_attributes: true,
+        reorder_imports: false,
+        reorder_modules: false,
     };
 
     let toml_string = toml::to_string(&config)?;


Test patch: