Skip to content

Commit

Permalink
Workaround for nightly build (#1982)
Browse files Browse the repository at this point in the history
# Description
Our backend fails to compile using the nightly compiler. For some reason
formatting the code generated for our contract bindings fails with
`rustfmt` on nightly.
Usually I would say that we should not change our code base to appease
the nightly compiler but in this case we only stop formatting auto
generate code that nobody (?) looks at anyway. And since this issue
seems to have blocked some people in the past I think it's an OK
trade-off.

# Changes
- [x] stop formatting auto generated contract bindings

## How to test
`cargo +nightly build` does not fail
  • Loading branch information
MartinquaXD authored Oct 18, 2023
1 parent 1ab3a43 commit 53b77c1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crates/contracts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,16 @@ fn generate_contract_with_config(

println!("cargo:rerun-if-changed={}", path.display());

config(ContractBuilder::new().visibility_modifier("pub"))
.generate(&contract)
.unwrap()
.write_to_file(Path::new(&dest).join(format!("{name}.rs")))
.unwrap();
config(
ContractBuilder::new()
// for some reason formatting the generate code is broken on nightly
.rustfmt(false)
.visibility_modifier("pub"),
)
.generate(&contract)
.unwrap()
.write_to_file(Path::new(&dest).join(format!("{name}.rs")))
.unwrap();
}

fn addr(s: &str) -> Address {
Expand Down

0 comments on commit 53b77c1

Please sign in to comment.