From 93f096b726990c93bd865d7856255c20735a4d11 Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 20 Nov 2019 01:52:33 +0800 Subject: [PATCH] Fix lint errors when singlepass is disabled. --- src/bin/wasmer.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 5c308f42d..03e19f7eb 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -860,27 +860,27 @@ fn validate(validate: Validate) { } } -fn get_compiler_by_backend(backend: Backend, opts: &Run) -> Option> { - use wasmer_runtime_core::codegen::MiddlewareChain; - let opts = opts.clone(); - let middlewares_gen = move || { - let mut middlewares = MiddlewareChain::new(); - if opts.call_trace { - use wasmer_middleware_common::call_trace::CallTrace; - middlewares.push(CallTrace::new()); - } - if opts.block_trace { - use wasmer_middleware_common::block_trace::BlockTrace; - middlewares.push(BlockTrace::new()); - } - middlewares - }; - +fn get_compiler_by_backend(backend: Backend, _opts: &Run) -> Option> { Some(match backend { #[cfg(feature = "backend-singlepass")] Backend::Singlepass => { use wasmer_runtime_core::codegen::StreamingCompiler; use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; + use wasmer_runtime_core::codegen::MiddlewareChain; + + let opts = _opts.clone(); + let middlewares_gen = move || { + let mut middlewares = MiddlewareChain::new(); + if opts.call_trace { + use wasmer_middleware_common::call_trace::CallTrace; + middlewares.push(CallTrace::new()); + } + if opts.block_trace { + use wasmer_middleware_common::block_trace::BlockTrace; + middlewares.push(BlockTrace::new()); + } + middlewares + }; let c: StreamingCompiler = StreamingCompiler::new(middlewares_gen);