Skip to content

Commit 93f2078

Browse files
authored
Merge pull request #76 from dtolnay/rustfmtbug
Work around rustfmt "rewriting static" bug
2 parents 8f7bb3a + 39a3f75 commit 93f2078

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

examples/update/update-examples.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() -> Result<()> {
4747

4848
// Write output.rustfmt.rs
4949
let output_path = manifest_dir.join("..").join("output.rustfmt.rs");
50-
let output_file = File::create(output_path)?;
50+
let output_file = File::create(&output_path)?;
5151
Command::new("rustfmt")
5252
.arg("--edition=2021")
5353
.arg("--config=reorder_imports=false")
@@ -63,5 +63,12 @@ fn main() -> Result<()> {
6363
.spawn()?
6464
.wait()?;
6565

66+
// Work around https://github.com/rust-lang/rustfmt/issues/6210
67+
let rustfmt_content = fs::read_to_string(&output_path)?;
68+
fs::write(
69+
&output_path,
70+
rustfmt_content.replace("rewriting static\n", ""),
71+
)?;
72+
6673
Ok(())
6774
}

0 commit comments

Comments
 (0)