From 2b9c48d5f91dc27325fd65bedc213b80fe62df5f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Apr 2018 11:25:30 -0700 Subject: [PATCH] Favor `if let` instead of `is_some` + `unwrap` --- crates/cli-support/src/wasm2es6js.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/cli-support/src/wasm2es6js.rs b/crates/cli-support/src/wasm2es6js.rs index 906c8a21..11c39e11 100644 --- a/crates/cli-support/src/wasm2es6js.rs +++ b/crates/cli-support/src/wasm2es6js.rs @@ -29,7 +29,7 @@ impl Config { self.base64 = base64; self } - + pub fn fetch(&mut self, path: Option) -> &mut Self { self.fetch_path = path; self @@ -195,7 +195,7 @@ impl Output { .then(obj => {{ wasm = obj.instance; {memory} - }})", + }})", imports = imports, memory = if export_mem { "memory = wasm.exports.memory;" } else { "" }, ); @@ -213,12 +213,12 @@ impl Output { }}", base64 = base64::encode(&wasm)), inst ) - } else if self.fetch_path.is_some() { + } else if let Some(ref path) = self.fetch_path { ( String::new(), format!("fetch('{path}') .then(res => res.arrayBuffer()) - .then(bytes => {inst})", path = self.fetch_path.unwrap(), inst = inst) + .then(bytes => {inst})", path = path, inst = inst) ) } else { panic!("the option --base64 or --fetch is required");