From 82db91372f597a0de834937dbb5edabeb68b0138 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 24 Sep 2020 09:29:18 -0400 Subject: [PATCH] refactor: Simplify op_fetch_asset signature (#7655) --- cli/op_fetch_asset.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/op_fetch_asset.rs b/cli/op_fetch_asset.rs index c936a9370f..3370b765f8 100644 --- a/cli/op_fetch_asset.rs +++ b/cli/op_fetch_asset.rs @@ -4,6 +4,8 @@ pub use deno_core::v8_set_flags; use deno_core::BufVec; use deno_core::Op; +use deno_core::OpState; +use std::cell::RefCell; use std::collections::HashMap; use std::path::PathBuf; use std::rc::Rc; @@ -82,13 +84,13 @@ fn get_asset(name: &str) -> Option<&'static str> { /// Warning: Returns a non-JSON op dispatcher. Must be manually attached to /// JsRuntime. -pub fn op_fetch_asset( - custom_assets: HashMap, -) -> impl Fn(Rc, BufVec) -> Op { +pub fn op_fetch_asset( + custom_assets: HashMap, +) -> impl Fn(Rc>, BufVec) -> Op { for (_, path) in custom_assets.iter() { println!("cargo:rerun-if-changed={}", path.display()); } - move |_state: Rc, bufs: BufVec| -> Op { + move |_state: Rc>, bufs: BufVec| -> Op { assert_eq!(bufs.len(), 1, "Invalid number of arguments"); let name = std::str::from_utf8(&bufs[0]).unwrap();