Skip to content

Commit 2a9e948

Browse files
committed
refactor: cargo fmt
1 parent 9802f96 commit 2a9e948

2 files changed

Lines changed: 16 additions & 19 deletions

File tree

deploy-tool/build.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,21 @@ fn main() {
3434
}
3535

3636
// Copy the wasm to OUT_DIR so include_bytes! can find it
37-
let wasm_src = nested_target_dir.join("wasm32-unknown-unknown/release/web_container_contract.wasm");
37+
let wasm_src =
38+
nested_target_dir.join("wasm32-unknown-unknown/release/web_container_contract.wasm");
3839
let wasm_dst = out_dir.join("web_container_contract.wasm");
3940
fs::copy(&wasm_src, &wasm_dst).expect("Failed to copy wasm to OUT_DIR");
40-
println!("cargo:rustc-env=BUNDLED_CONTRACT_PATH={}", wasm_dst.display());
41+
println!(
42+
"cargo:rustc-env=BUNDLED_CONTRACT_PATH={}",
43+
wasm_dst.display()
44+
);
4145

4246
// Build web-container-tool for native target
4347
let status = Command::new(env::var("CARGO").unwrap_or_else(|_| "cargo".into()))
4448
.env("CARGO_TARGET_DIR", &nested_target_dir)
4549
.env_remove("CARGO_ENCODED_RUSTFLAGS")
4650
.env_remove("CARGO_BUILD_TARGET")
47-
.args([
48-
"build",
49-
"--release",
50-
"--package",
51-
"web-container-tool",
52-
])
51+
.args(["build", "--release", "--package", "web-container-tool"])
5352
.status()
5453
.expect("Failed to build web-container-tool");
5554

deploy-tool/src/main.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ fn read_config() -> Result<Config, Box<dyn Error>> {
8484
/// Initializes the global config. Must be called before using `config()`.
8585
fn init_config() -> Result<(), Box<dyn Error>> {
8686
let cfg = read_config()?;
87-
CONFIG
88-
.set(cfg)
89-
.map_err(|_| "Config already initialized")?;
87+
CONFIG.set(cfg).map_err(|_| "Config already initialized")?;
9088
Ok(())
9189
}
9290

9391
/// Returns a reference to the global config.
9492
pub fn config() -> &'static Config {
95-
CONFIG.get().expect("Config not initialized. Call init_config() first.")
93+
CONFIG
94+
.get()
95+
.expect("Config not initialized. Call init_config() first.")
9696
}
9797

9898
fn default_storage_path(file: &str) -> PathBuf {
@@ -412,8 +412,10 @@ fn deploy(version: u32) -> Result<(), Box<dyn Error>> {
412412
let webapp_parameters = default_storage_path("webapp.parameters");
413413

414414
let version_path = default_storage_path("version");
415-
let version_saved = std::fs::read_to_string(&version_path)
416-
.expect(&format!("version file not found: {}", version_path.display()));
415+
let version_saved = std::fs::read_to_string(&version_path).expect(&format!(
416+
"version file not found: {}",
417+
version_path.display()
418+
));
417419
let version_parsed: u32 = version_saved.trim().parse().unwrap();
418420
let version_chosen = std::cmp::max(version_parsed, version);
419421

@@ -426,11 +428,7 @@ fn deploy(version: u32) -> Result<(), Box<dyn Error>> {
426428
let repo_root = get_repo_root()?;
427429
let static_path = repo_root.join(folder);
428430
if !static_path.exists() {
429-
return Err(format!(
430-
"Static folder not found: {}",
431-
static_path.display()
432-
)
433-
.into());
431+
return Err(format!("Static folder not found: {}", static_path.display()).into());
434432
}
435433
static_path
436434
}

0 commit comments

Comments
 (0)