We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8a8147 commit eee7f85Copy full SHA for eee7f85
expand.py
@@ -2,6 +2,8 @@
2
3
import sys
4
import getopt
5
+import tempfile
6
+import subprocess
7
8
usage = '''Usage:expand.py [options] <output modules>
9
Output Modules:
@@ -92,6 +94,14 @@ def output_file(filename):
92
94
if not i.startswith('internal'):
93
95
output_data.append('use {}::*;'.format(i))
96
-print(output_header)
-for i in output_data:
97
- print(i)
+# rustfmt
98
+with tempfile.TemporaryDirectory() as temp_dir:
99
+ temp_file = temp_dir + '/output.rs'
100
+ with open(temp_file, 'w') as f:
101
+ print(output_header, file=f)
102
+ for i in output_data:
103
+ print(i, file=f)
104
+ output_data = subprocess.run(["rustfmt", temp_file])
105
+ with open(temp_file, 'r') as f:
106
+ for line in f:
107
+ print(line, end="")
0 commit comments