From b6fda735ee0106b72500d927b9695a27ecd519f3 Mon Sep 17 00:00:00 2001 From: F001 Date: Fri, 30 Nov 2018 11:03:00 +0800 Subject: Replace mutex by atomics (#1238) --- src/deno_dir.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/deno_dir.rs') diff --git a/src/deno_dir.rs b/src/deno_dir.rs index a7b9f97d6..f75d35bc4 100644 --- a/src/deno_dir.rs +++ b/src/deno_dir.rs @@ -41,16 +41,13 @@ impl DenoDir { // https://github.com/denoland/deno/blob/golang/deno_dir.go#L99-L111 pub fn new( reload: bool, - custom_root: Option<&Path>, + custom_root: Option, ) -> std::io::Result { // Only setup once. let home_dir = dirs::home_dir().expect("Could not get home directory."); let default = home_dir.join(".deno"); - let root: PathBuf = match custom_root { - None => default, - Some(path) => path.to_path_buf(), - }; + let root: PathBuf = custom_root.unwrap_or(default); let gen = root.as_path().join("gen"); let deps = root.as_path().join("deps"); let deps_http = deps.join("http"); @@ -390,8 +387,8 @@ pub struct CodeFetchOutput { #[cfg(test)] pub fn test_setup() -> (TempDir, DenoDir) { let temp_dir = TempDir::new().expect("tempdir fail"); - let deno_dir = - DenoDir::new(false, Some(temp_dir.path())).expect("setup fail"); + let deno_dir = DenoDir::new(false, Some(temp_dir.path().to_path_buf())) + .expect("setup fail"); (temp_dir, deno_dir) } -- cgit v1.2.3