diff options
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/doc.rs | 2 | ||||
-rw-r--r-- | cli/tools/installer.rs | 6 | ||||
-rw-r--r-- | cli/tools/repl.rs | 12 |
3 files changed, 8 insertions, 12 deletions
diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index b1ab0174f..6e4d39954 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -14,6 +14,7 @@ use crate::write_to_stdout_ignore_sigpipe; use deno_core::error::AnyError; use deno_core::futures::future::FutureExt; use deno_core::futures::Future; +use deno_core::parking_lot::Mutex; use deno_core::resolve_url_or_path; use deno_doc as doc; use deno_doc::parser::DocFileLoader; @@ -21,7 +22,6 @@ use deno_runtime::permissions::Permissions; use std::path::PathBuf; use std::pin::Pin; use std::sync::Arc; -use std::sync::Mutex; use swc_ecmascript::parser::Syntax; type DocResult = Result<(Syntax, String), doc::DocError>; diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index 5877494d1..b6bb8bbb2 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -317,8 +317,8 @@ fn is_in_path(dir: &Path) -> bool { #[cfg(test)] mod tests { use super::*; + use deno_core::parking_lot::Mutex; use std::process::Command; - use std::sync::Mutex; use tempfile::TempDir; use test_util::tests_path; @@ -401,7 +401,7 @@ mod tests { #[test] fn install_basic() { - let _guard = ENV_LOCK.lock().ok(); + let _guard = ENV_LOCK.lock(); let temp_dir = TempDir::new().expect("tempdir fail"); let temp_dir_str = temp_dir.path().to_string_lossy().to_string(); // NOTE: this test overrides environmental variables @@ -591,7 +591,7 @@ mod tests { #[test] fn install_custom_dir_env_var() { - let _guard = ENV_LOCK.lock().ok(); + let _guard = ENV_LOCK.lock(); let temp_dir = TempDir::new().expect("tempdir fail"); let bin_dir = temp_dir.path().join("bin"); std::fs::create_dir(&bin_dir).unwrap(); diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index 662e1a8d7..e3dbc5be8 100644 --- a/cli/tools/repl.rs +++ b/cli/tools/repl.rs @@ -9,6 +9,7 @@ use crate::media_type::MediaType; use crate::program_state::ProgramState; use deno_core::error::AnyError; use deno_core::futures::FutureExt; +use deno_core::parking_lot::Mutex; use deno_core::serde_json::json; use deno_core::serde_json::Value; use deno_core::LocalInspectorSession; @@ -28,7 +29,6 @@ use std::borrow::Cow; use std::cell::RefCell; use std::path::PathBuf; use std::sync::Arc; -use std::sync::Mutex; use swc_ecmascript::parser::token::{Token, Word}; use tokio::sync::mpsc::channel; use tokio::sync::mpsc::unbounded_channel; @@ -324,21 +324,17 @@ impl ReplEditor { } pub fn readline(&self) -> Result<String, ReadlineError> { - self.inner.lock().unwrap().readline("> ") + self.inner.lock().readline("> ") } pub fn add_history_entry(&self, entry: String) { - self.inner.lock().unwrap().add_history_entry(entry); + self.inner.lock().add_history_entry(entry); } pub fn save_history(&self) -> Result<(), AnyError> { std::fs::create_dir_all(self.history_file_path.parent().unwrap())?; - self - .inner - .lock() - .unwrap() - .save_history(&self.history_file_path)?; + self.inner.lock().save_history(&self.history_file_path)?; Ok(()) } } |