From 53b77c100235b40fbe3d83d0565b1afddec035e2 Mon Sep 17 00:00:00 2001 From: Martin Beckmann Date: Wed, 18 Oct 2023 10:24:53 +0200 Subject: [PATCH] Workaround for nightly build (#1982) # 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 --- crates/contracts/build.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs index 498ba9c0ae..c0af4b113b 100644 --- a/crates/contracts/build.rs +++ b/crates/contracts/build.rs @@ -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 {