From 8af28d34030834cfc74e7e3a5249852d311a9469 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 19 Sep 2019 20:42:56 +0100 Subject: [PATCH] Remove module_from_bytes helper --- chisel/src/main.rs | 2 +- libchisel/src/lib.rs | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/chisel/src/main.rs b/chisel/src/main.rs index 33596e1..e544e5e 100644 --- a/chisel/src/main.rs +++ b/chisel/src/main.rs @@ -309,7 +309,7 @@ fn execute_module(context: &ModuleContext, module: &mut Module) -> bool { fn chisel_execute(context: &ChiselContext) -> Result { if let Ok(buffer) = read(context.file()) { - if let Ok(module) = module_from_bytes(&buffer) { + if let Ok(module) = Module::from_bytes(&buffer) { // If we do not parse the NamesSection here, parity-wasm will drop it at serialisation // It is useful to have this for a number of optimisation passes, including binaryenopt and snip // TODO: better error handling diff --git a/libchisel/src/lib.rs b/libchisel/src/lib.rs index d809693..7e22dbd 100644 --- a/libchisel/src/lib.rs +++ b/libchisel/src/lib.rs @@ -28,11 +28,6 @@ pub mod verifyimports; mod depgraph; -// This helper is exported here for users of this library not needing to import parity_wasm. -pub fn module_from_bytes>(input: T) -> Result { - Ok(Module::from_bytes(input)?) -} - #[derive(Eq, PartialEq, Debug)] pub enum ModuleKind { Creator, @@ -250,17 +245,4 @@ mod tests { let result = as_trait.validate(&Module::default()); assert!(result.is_ok()); } - - #[test] - fn loading_from_bytes() { - let module_orig = Module::default(); - - let output = module_orig.clone().to_bytes().unwrap(); - let module = module_from_bytes(&output).unwrap(); - assert_eq!(module_orig, module); - - let output = module_orig.clone().to_bytes().unwrap(); - let module = Module::from_bytes(&output).unwrap(); - assert_eq!(module_orig, module); - } }