summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/args/config_file.rs2
-rw-r--r--cli/args/lockfile.rs6
-rw-r--r--cli/args/mod.rs8
-rw-r--r--cli/bench/http.rs6
-rw-r--r--cli/graph_util.rs2
-rw-r--r--cli/node/mod.rs4
-rw-r--r--cli/npm/resolution/mod.rs8
-rw-r--r--cli/npm/resolution/specifier.rs2
-rw-r--r--cli/proc_state.rs2
-rw-r--r--cli/standalone.rs5
-rw-r--r--cli/tools/check.rs2
-rw-r--r--cli/tools/repl/mod.rs2
-rw-r--r--cli/tools/vendor/test.rs8
-rw-r--r--cli/worker.rs2
14 files changed, 32 insertions, 27 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs
index 0a708eeee..0c0e5d2fa 100644
--- a/cli/args/config_file.rs
+++ b/cli/args/config_file.rs
@@ -71,7 +71,7 @@ pub struct IgnoredCompilerOptions {
impl fmt::Display for IgnoredCompilerOptions {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut codes = self.items.clone();
- codes.sort();
+ codes.sort_unstable();
if let Some(specifier) = &self.maybe_specifier {
write!(f, "Unsupported compiler options in \"{}\".\n The following options were ignored:\n {}", specifier, codes.join(", "))
} else {
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs
index 5f690b3a1..87f47255a 100644
--- a/cli/args/lockfile.rs
+++ b/cli/args/lockfile.rs
@@ -1,4 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+use std::collections::BTreeMap;
+use std::io::Write;
+use std::path::PathBuf;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
@@ -6,9 +9,6 @@ use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json;
use log::debug;
-use std::collections::BTreeMap;
-use std::io::Write;
-use std::path::PathBuf;
use crate::args::config_file::LockConfig;
use crate::args::ConfigFile;
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 97b70698d..d677cf832 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -329,11 +329,11 @@ impl CliOptions {
// if a location is set, then the ascii serialization of the location is
// used, unless the origin is opaque, and then no storage origin is set, as
// we can't expect the origin to be reproducible
- let storage_origin = location.origin().ascii_serialization();
- if storage_origin == "null" {
- None
+ let storage_origin = location.origin();
+ if storage_origin.is_tuple() {
+ Some(storage_origin.ascii_serialization())
} else {
- Some(storage_origin)
+ None
}
} else if let Some(config_file) = &self.maybe_config_file {
// otherwise we will use the path to the config file
diff --git a/cli/bench/http.rs b/cli/bench/http.rs
index c95ba9721..7c416f93c 100644
--- a/cli/bench/http.rs
+++ b/cli/bench/http.rs
@@ -1,8 +1,10 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use super::Result;
use std::sync::atomic::{AtomicU16, Ordering};
use std::{collections::HashMap, path::Path, process::Command, time::Duration};
+
+use super::Result;
+
pub use test_util::{parse_wrk_output, WrkOutput as HttpBenchmarkResult};
// Some of the benchmarks in this file have been renamed. In case the history
// somehow gets messed up:
@@ -27,7 +29,7 @@ pub fn benchmark(
let mut res = HashMap::new();
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let http_dir = manifest_dir.join("bench").join("http");
- for entry in std::fs::read_dir(http_dir.clone())? {
+ for entry in std::fs::read_dir(&http_dir)? {
let entry = entry?;
let pathbuf = entry.path();
let path = pathbuf.to_str().unwrap();
diff --git a/cli/graph_util.rs b/cli/graph_util.rs
index 62db0a82c..d815e3311 100644
--- a/cli/graph_util.rs
+++ b/cli/graph_util.rs
@@ -571,7 +571,7 @@ pub async fn create_graph_and_maybe_check(
&graph.roots,
Arc::new(RwLock::new(graph_data)),
&cache,
- ps.npm_resolver.clone(),
+ &ps.npm_resolver,
check::CheckOptions {
type_check_mode: ps.options.type_check_mode(),
debug: ps.options.log_level() == Some(log::Level::Debug),
diff --git a/cli/node/mod.rs b/cli/node/mod.rs
index 5c083e2fd..e6cc22255 100644
--- a/cli/node/mod.rs
+++ b/cli/node/mod.rs
@@ -5,8 +5,6 @@ use std::collections::VecDeque;
use std::path::Path;
use std::path::PathBuf;
-use crate::cache::NodeAnalysisCache;
-use crate::deno_std::CURRENT_STD_URL;
use deno_ast::CjsAnalysis;
use deno_ast::MediaType;
use deno_ast::ModuleSpecifier;
@@ -36,6 +34,8 @@ use deno_runtime::deno_node::NODE_GLOBAL_THIS_NAME;
use once_cell::sync::Lazy;
use regex::Regex;
+use crate::cache::NodeAnalysisCache;
+use crate::deno_std::CURRENT_STD_URL;
use crate::file_fetcher::FileFetcher;
use crate::npm::NpmPackageReference;
use crate::npm::NpmPackageReq;
diff --git a/cli/npm/resolution/mod.rs b/cli/npm/resolution/mod.rs
index c6e1c5d25..bd408e3ec 100644
--- a/cli/npm/resolution/mod.rs
+++ b/cli/npm/resolution/mod.rs
@@ -210,7 +210,7 @@ impl NpmResolutionPackage {
pub struct NpmResolution {
api: RealNpmRegistryApi,
snapshot: RwLock<NpmResolutionSnapshot>,
- update_sempahore: tokio::sync::Semaphore,
+ update_semaphore: tokio::sync::Semaphore,
}
impl std::fmt::Debug for NpmResolution {
@@ -230,7 +230,7 @@ impl NpmResolution {
Self {
api,
snapshot: RwLock::new(initial_snapshot.unwrap_or_default()),
- update_sempahore: tokio::sync::Semaphore::new(1),
+ update_semaphore: tokio::sync::Semaphore::new(1),
}
}
@@ -239,7 +239,7 @@ impl NpmResolution {
package_reqs: Vec<NpmPackageReq>,
) -> Result<(), AnyError> {
// only allow one thread in here at a time
- let _permit = self.update_sempahore.acquire().await.unwrap();
+ let _permit = self.update_semaphore.acquire().await.unwrap();
let snapshot = self.snapshot.read().clone();
let snapshot = self
@@ -255,7 +255,7 @@ impl NpmResolution {
package_reqs: HashSet<NpmPackageReq>,
) -> Result<(), AnyError> {
// only allow one thread in here at a time
- let _permit = self.update_sempahore.acquire().await.unwrap();
+ let _permit = self.update_semaphore.acquire().await.unwrap();
let snapshot = self.snapshot.read().clone();
let has_removed_package = !snapshot
diff --git a/cli/npm/resolution/specifier.rs b/cli/npm/resolution/specifier.rs
index 7ab327ba5..06efac156 100644
--- a/cli/npm/resolution/specifier.rs
+++ b/cli/npm/resolution/specifier.rs
@@ -132,7 +132,7 @@ impl std::fmt::Display for NpmPackageReq {
impl NpmPackageReq {
pub fn from_str(text: &str) -> Result<Self, AnyError> {
- // probably should do something more targetted in the future
+ // probably should do something more targeted in the future
let reference = NpmPackageReference::from_str(&format!("npm:{}", text))?;
Ok(reference.req)
}
diff --git a/cli/proc_state.rs b/cli/proc_state.rs
index 2fe1f44f2..eb672d8d0 100644
--- a/cli/proc_state.rs
+++ b/cli/proc_state.rs
@@ -448,7 +448,7 @@ impl ProcState {
&roots,
graph_data,
&check_cache,
- self.npm_resolver.clone(),
+ &self.npm_resolver,
options,
)?;
if !check_result.diagnostics.is_empty() {
diff --git a/cli/standalone.rs b/cli/standalone.rs
index 006575b8d..c93631327 100644
--- a/cli/standalone.rs
+++ b/cli/standalone.rs
@@ -161,14 +161,13 @@ impl ModuleLoader for EmbeddedModuleLoader {
_maybe_referrer: Option<ModuleSpecifier>,
_is_dynamic: bool,
) -> Pin<Box<deno_core::ModuleSourceFuture>> {
- let module_specifier = module_specifier.clone();
-
- let is_data_uri = get_source_from_data_url(&module_specifier).ok();
+ let is_data_uri = get_source_from_data_url(module_specifier).ok();
let module = self
.eszip
.get_module(module_specifier.as_str())
.ok_or_else(|| type_error("Module not found"));
+ let module_specifier = module_specifier.clone();
async move {
if let Some((source, _)) = is_data_uri {
return Ok(deno_core::ModuleSource {
diff --git a/cli/tools/check.rs b/cli/tools/check.rs
index 0c57af0b0..6e2ccd4ff 100644
--- a/cli/tools/check.rs
+++ b/cli/tools/check.rs
@@ -58,7 +58,7 @@ pub fn check(
roots: &[(ModuleSpecifier, ModuleKind)],
graph_data: Arc<RwLock<GraphData>>,
cache: &TypeCheckCache,
- npm_resolver: NpmPackageResolver,
+ npm_resolver: &NpmPackageResolver,
options: CheckOptions,
) -> Result<CheckResult, AnyError> {
let check_js = options.ts_config.get_check_js();
diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs
index 929a1b5d8..fc03dee2f 100644
--- a/cli/tools/repl/mod.rs
+++ b/cli/tools/repl/mod.rs
@@ -183,5 +183,5 @@ pub async fn run(flags: Flags, repl_flags: ReplFlags) -> Result<i32, AnyError> {
}
}
- Ok(repl_session.worker.get_exit_code())
+ Ok(repl_session.worker.exit_code())
}
diff --git a/cli/tools/vendor/test.rs b/cli/tools/vendor/test.rs
index 61c885731..7171b8463 100644
--- a/cli/tools/vendor/test.rs
+++ b/cli/tools/vendor/test.rs
@@ -242,7 +242,7 @@ impl VendorTestBuilder {
let import_map = files.remove(&output_dir.join("import_map.json"));
let mut files = files
.iter()
- .map(|(path, text)| (path_to_string(path), text.clone()))
+ .map(|(path, text)| (path_to_string(path), text.to_string()))
.collect::<Vec<_>>();
files.sort_by(|a, b| a.0.cmp(&b.0));
@@ -293,7 +293,11 @@ fn make_path(text: &str) -> PathBuf {
}
}
-fn path_to_string(path: &Path) -> String {
+fn path_to_string<P>(path: P) -> String
+where
+ P: AsRef<Path>,
+{
+ let path = path.as_ref();
// inverse of the function above
let path = path.to_string_lossy();
if cfg!(windows) {
diff --git a/cli/worker.rs b/cli/worker.rs
index 0b991fdd6..ea50966f4 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -100,7 +100,7 @@ impl CliMainWorker {
.await?;
}
- Ok(self.worker.get_exit_code())
+ Ok(self.worker.exit_code())
}
pub async fn run_for_watcher(self) -> Result<(), AnyError> {