diff options
author | Yiyu Lin <linyiyu1992@gmail.com> | 2023-01-06 03:29:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 14:29:50 -0500 |
commit | 896dd56b7af06fea6604a5596a6ffd17e7e52e6e (patch) | |
tree | 92d3c94afe4923f1d1faccc8034a03f78b807ade /cli/npm | |
parent | 4e6b78cb43ece70df28281c8033b51366b110acf (diff) |
refactor(cli,core,ext,rt): remove some unnecessary `clone` or `malloc` (#17274)
Diffstat (limited to 'cli/npm')
-rw-r--r-- | cli/npm/resolution/mod.rs | 8 | ||||
-rw-r--r-- | cli/npm/resolution/specifier.rs | 2 |
2 files changed, 5 insertions, 5 deletions
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) } |