Skip to content

Commit

Permalink
Merge pull request #76 from dtolnay/rustfmtbug
Browse files Browse the repository at this point in the history
Work around rustfmt "rewriting static" bug
  • Loading branch information
dtolnay authored Jun 24, 2024
2 parents 8f7bb3a + 39a3f75 commit 93f2078
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/update/update-examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn main() -> Result<()> {

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

// Work around https://github.com/rust-lang/rustfmt/issues/6210
let rustfmt_content = fs::read_to_string(&output_path)?;
fs::write(
&output_path,
rustfmt_content.replace("rewriting static\n", ""),
)?;

Ok(())
}

0 comments on commit 93f2078

Please sign in to comment.